62,025
社区成员
发帖
与我相关
我的任务
分享
protected void GridViewData_RowDataBound(object sender, GridViewRowEventArgs e)
{
switch (e.Row.RowType)
{
case DataControlRowType.DataRow:
PostBackOptions myPostBackOptions = new PostBackOptions(this);
myPostBackOptions.AutoPostBack = false;
myPostBackOptions.PerformValidation = false;
myPostBackOptions.RequiresJavaScriptProtocol = true; //加入javascript:头
String evt = Page.ClientScript.GetPostBackClientHyperlink(sender as GridView, "Select$" + e.Row.RowIndex.ToString());
e.Row.Attributes.Add("onclick", evt);
break;
}
}
protected void GridViewData_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = GridViewData.Rows[GridViewData.SelectedIndex].Cells[0].Text;
}