zoukankan      html  css  js  c++  java
  • GridView事件取值操作

    1.通过设置建DataKey
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Id = this.GridView1.SelectedDataKey.Value.ToString();
        Response.Redirect("UpdateCurriculum.aspx?CId=" + Id.ToString());
    }
    2.GridView中CommandName的使用
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
         if (e.Row.RowType == DataControlRowType.DataRow)
         {

            LinkButton LinkButton1 = (LinkButton)e.Row.FindControl("LinkButton1");
            
    LinkButton1.CommandArgument = e.Row.RowIndex.ToString();
            
    LinkButton LinkButton2 = (LinkButton)e.Row.FindControl("LinkButton2");
            
    LinkButton2.CommandArgument = e.Row.RowIndex.ToString();
        
    }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
         if (e.CommandName == "OpeanteName1")
         {
            
    int index = Convert.ToInt32(e.CommandArgument);
            
    GridViewRow row = GridView1.Rows[index];
            
    Response.Write(index);
    }
         if (e.CommandName == "OpeanteName1")
         {
            
    int index = Convert.ToInt32(e.CommandArgument);
            
    GridViewRow row = GridView1.Rows[index];
            
    Response.Write(index+"**");
        }

    }

  • 相关阅读:
    S3:代理模式 Proxy
    S2:外观模式 Facade
    S1:适配器 Adapter
    C5:单例模式 Singleton
    C4:原型模式 Prototype
    C3:建造者模式 Builder
    C2:抽象工厂 Abstract Factory
    C1:工厂模式 Factory
    设计模式分类
    数据访问对象模式
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/933720.html
Copyright © 2011-2022 走看看