asp.net中取得gridview选中的值
想在asp.net中取得gridview选中行的值传给后台,求帮助!ProtectedSubGridView1_RowDataBound(ByValsenderAsObj...
想在asp.net中取得gridview选中行的值传给后台,求帮助!
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
'e.Row.Attributes.Add("onclick", "this.style.backgroundColor='yellow'")
'e.Row.Attributes.Add("onmouseup", "this.style.backgroundColor='white'")
e.Row.Attributes.Add("onclick", "if(window.oldtr!=null){window.oldtr.runtimeStyle.cssText='';}this.runtimeStyle.cssText='background-color:#e6c5fc';window.oldtr=this")
' Dim drv As System.Data.DataView = CType(e.Row.DataItem, System.Data.DataView)
End If
' textbox2.Text=GridView1.Rows[e.RowIndex].Cells[Colunm0].Text
TextBox2.Text = GridView1.Rows(1)
' e.Row.Attributes.Add("onclick", "var gdview=documentgetElementById("<% =gdviewClientID %>"); var value=gdviewrows(rowIndex)cells(列号)innerText; ")
End Sub 展开
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
'e.Row.Attributes.Add("onclick", "this.style.backgroundColor='yellow'")
'e.Row.Attributes.Add("onmouseup", "this.style.backgroundColor='white'")
e.Row.Attributes.Add("onclick", "if(window.oldtr!=null){window.oldtr.runtimeStyle.cssText='';}this.runtimeStyle.cssText='background-color:#e6c5fc';window.oldtr=this")
' Dim drv As System.Data.DataView = CType(e.Row.DataItem, System.Data.DataView)
End If
' textbox2.Text=GridView1.Rows[e.RowIndex].Cells[Colunm0].Text
TextBox2.Text = GridView1.Rows(1)
' e.Row.Attributes.Add("onclick", "var gdview=documentgetElementById("<% =gdviewClientID %>"); var value=gdviewrows(rowIndex)cells(列号)innerText; ")
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询