[VB.NET]如何取得DATAGIRD里CHECKBOX和TEXTBOX的值?

前端之家收集整理的这篇文章主要介绍了[VB.NET]如何取得DATAGIRD里CHECKBOX和TEXTBOX的值?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何取得DATAGIRD里CHECKBox和TEXTBox的值? 我想把DATAGRID的里的值取出来,放在一个DATATBALE里,代码如下: Public Function dt() As DataTable Dim i As Integer Dim j As Integer Dim dt1 As DataTable = New DataTable dt1.Columns.Add(New DataColumn( delflg,Type.GetType( System.Boolean ))) dt1.Columns.Add(New DataColumn( txtMtype,Type.GetType( System.String ))) dt1.Columns.Add(New DataColumn( txtBikou,Type.GetType( System.String ))) Dim delflg As Boolean Dim txtMtype As TextBox Dim txtBikou As TextBox Dim listitem As DataGridItem max_row = Me.dgMeetingtype.Items.Count For i = 0 To max_row - 1 listitem = Me.dgMeetingtype.Items(i) If i < max_row - 1 Then delflg = CType(listitem.FindControl( chkDel ),CheckBox).Checked End If txtMtype = CType(listitem.FindControl( txtMtype ),TextBox) txtBikou = CType(listitem.FindControl( txtBiko ),TextBox) Dim myRow As DataRow = dt1.NewRow() myRow(0) = delflg myRow(1) = txtMtype.Text myRow(2) = txtBikou.Text dt1.Rows.Add(myRow) Next i Return dt1 End Function 这样有什么不对吗?好像是CHECKBox和TEXTBox的值改了,我却获取不到,得到的还是绑定DATAGRID时候的值。高手帮帮忙啊~! __________________________________________________________________________ 自己顶一下,希望有高手来解决!谢谢了 __________________________________________________________________________ TextBox tb=(TextBox)datagrid1.findControl( your TextBoxid ); __________________________________________________________________________ 嗯,问题已解决。 我的问题出在PAGE_LOAD里 加一个ISPOSTBACK方法就好了。 谢谢! __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/263386.html

猜你在找的VB相关文章