gridview 行的选定
我的gridview的数据绑定是一个datatable,这样可以根据输入的行数,动态增加表行
apsx:
Dim dt As New Data.DataTable
Dim getnumtext As Integer
Dim i As Integer
Dim s As String
dt.Columns.Add(New Data.DataColumn( "Downid ", GetType(String)))
dt.Columns.Add(New Data.DataColumn( "Downurl ", GetType(String)))
dt.Columns.Add(New Data.DataColumn( "Downfile ", GetType(String)))
getnumtext = Val(Trim(TextBox1.Text))
If getnumtext <> 0 Then
For i = 1 To getnumtext
Dim row As Data.DataRow
row = dt.NewRow()
row( "Downid ") = " "
row( "Downurl ") = " "
row( "Downfile ") = " "
dt.Rows.Add(row)
Next
GridView1.DataSource = dt.DefaultView
GridView1.DataBind()
end if
但girdview1中显示的各行编辑中,如何获得所选择的行索行值?我用以下的只能显示所选择的行各列值:
Sub _ADD_File(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
'Dim _Grcount As Integer = GridView1.Rows.Count.ToString.Trim 'get gridview1 's count
Dim i As Integer = 0
For i = 0 To _Grcount - 1
Dim _turl As TextBox = GridView1.Rows(i).FindControl( "txturl ")
Dim _tfile