不使用GridView自带的btn,如AutoGenerateSelectButton

 protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onclick", "javascript:" + this.ClientScript.GetPostBackEventReference(this, "12345"));

        }
    }


继承IPostBackEventHandler  

public partial class Page1 : System.Web.UI.Page,IPostBackEventHandler   

实现接口

 public void RaisePostBackEvent(string eventArgument)
    {
        if (eventArgument == "12345")
        {
            Response.Write("DFSFSF");
        }
    }
 
 

你可能感兴趣的:(GridView)