C# gridview中的javascript在母版页下不工作
我想从gridview中选择一行,我正在使用以下代码:C# gridview中的javascript在母版页下不工作,c#,javascript,jquery,asp.net,gridview,C#,Javascript,Jquery,Asp.net,Gridview,我想从gridview中选择一行,我正在使用以下代码: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onclick
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", String.Format("javascript:__doPostBack('this','Select${0}')", e.Row.RowIndex));
}
}
它工作正常,但在使用母版页后,它停止工作。
请提出建议。我们需要查看更多代码,但请尝试将此行添加到母版页的页面加载中
ClientScript.GetPostBackEventReference(this, string.Empty);
\uuuu doPostBack
通过通常不会导致类似POST的链接按钮的控件进行注册。可能,在迁移到母版页之前,您的页面中可能有一个这样的问题。我的问题在使用以下代码后得到解决。。e、 Row.Attributes[“onclick”]=ClientScript.GetPostBackClientHyperlink(this.GridView1,“Select$”+e.Row.RowIndex);