zoukankan      html  css  js  c++  java
  • Reaper自定义模板

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Collections.Generic;

    namespace WebApplication1
    {
        public partial class _Default : System.Web.UI.Page
        {
            public class NumberLinkTemplate : ITemplate
            {

                #region ITemplate 成员

                public void InstantiateIn(Control container)
                {
                    LinkButton lb = new LinkButton();
                    lb.CommandName = "Index";
                    Literal lt = new Literal();
                    lt.Text = " ";
                    container.Controls.Add(lb);
                    container.Controls.Add(lt);
                    lb.DataBinding += new EventHandler(lb_DataBinding);
                }

                void lb_DataBinding(object sender, EventArgs e)
                {
                    LinkButton lbtn = (LinkButton)sender;
                    RepeaterItem container = (RepeaterItem)lbtn.NamingContainer;
                    lbtn.Text = container.DataItem.ToString();
                    lbtn.CommandArgument = container.DataItem.ToString();
                }

                #endregion
            }

            protected void Page_Load(object sender, EventArgs e)
            {
                List<string> linkNumberDataSource = new List<string>();
                for (int i = 1; i <= 10; i++)
                {
                    linkNumberDataSource.Add(i.ToString());
                }

                Repeater enterpriseRep = new Repeater();
                enterpriseRep.ItemTemplate = new NumberLinkTemplate();
                enterpriseRep.DataSource = linkNumberDataSource;
                enterpriseRep.DataBind();
                enterpriseRep.ItemCommand += new RepeaterCommandEventHandler(enterpriseRep_ItemCommand);
                this.Panel1.Controls.Add(enterpriseRep);
               
            }

            void enterpriseRep_ItemCommand(object source, RepeaterCommandEventArgs e)
            {
                Response.Write("CommandName:"+e.CommandName+"<br>"+"CommandArgument:"+e.CommandArgument);
            }
        }
    }

  • 相关阅读:
    【中位数 均分纸牌】 糖果传递
    【模板】 均分纸牌
    【离散化】 电影
    【离散化】 区间和
    【最大子矩阵】 城市游戏
    vue中如何引入Element-ui
    详细教你:如何搭建vue环境和创建一个新的vue项目
    vue中如何引入bootstrap
    十天冲刺(4)
    十天冲刺(3)
  • 原文地址:https://www.cnblogs.com/chenfulai/p/1353555.html
Copyright © 2011-2022 走看看