datagrid problem
-
Dear all, We have a VB.Net 2003 winforms application. I have created a datagrid "datagrid1" with 3 columns in it(FirstName, LastName, CheckboxColumn). One of the columns is a checkbox column. Lets say the user selected 5 checkbox rows(out of 20 rows), I would like to retrieve the FirstName & LastName values for these selected 5 rows from the Datagrid & display it in a listbox. Please advise how can it be done. Your help is much appreciated.
kissy
-
Dear all, We have a VB.Net 2003 winforms application. I have created a datagrid "datagrid1" with 3 columns in it(FirstName, LastName, CheckboxColumn). One of the columns is a checkbox column. Lets say the user selected 5 checkbox rows(out of 20 rows), I would like to retrieve the FirstName & LastName values for these selected 5 rows from the Datagrid & display it in a listbox. Please advise how can it be done. Your help is much appreciated.
kissy
-
-
if you want to retrive name on some button click, use
FindControl
method of grid view, and find the Checkbox then check which is selected or not. Hope this will help you.cheers, Abhijit
-
if you want to retrive name on some button click, use
FindControl
method of grid view, and find the Checkbox then check which is selected or not. Hope this will help you.cheers, Abhijit
I am placin a bit of code here-- an give me some idea to fulfill my requirement Dim rowCount As Integer = 0 Dim strname As String Dim i As Integer i = 0 Dim DemoGridItem As DataGridItem For Each DemoGridItem In DG1.Items Dim myCheckbox As CheckBox = CType(DemoGridItem.Cells(0).Controls(1), CheckBox) If myCheckbox.Checked Then rowCount += 1 end if next In the above code how can i store the selected checkbox perticular column in the selected rows? I want to update that array of columns in the database at a time later. Can i do this?
kissy
-
I am placin a bit of code here-- an give me some idea to fulfill my requirement Dim rowCount As Integer = 0 Dim strname As String Dim i As Integer i = 0 Dim DemoGridItem As DataGridItem For Each DemoGridItem In DG1.Items Dim myCheckbox As CheckBox = CType(DemoGridItem.Cells(0).Controls(1), CheckBox) If myCheckbox.Checked Then rowCount += 1 end if next In the above code how can i store the selected checkbox perticular column in the selected rows? I want to update that array of columns in the database at a time later. Can i do this?
kissy
Kissy16 wrote:
In the above code how can i store the selected checkbox perticular column in the selected rows?
Use
DataGridRow
class that can store particular rowcheers, Abhijit
-
Dear all, We have a VB.Net 2003 winforms application. I have created a datagrid "datagrid1" with 3 columns in it(FirstName, LastName, CheckboxColumn). One of the columns is a checkbox column. Lets say the user selected 5 checkbox rows(out of 20 rows), I would like to retrieve the FirstName & LastName values for these selected 5 rows from the Datagrid & display it in a listbox. Please advise how can it be done. Your help is much appreciated.
kissy
use this code foreach(gridview row in gridview1.rows) { } now this foreach loop move through all rows in that grid. now fetch the control and add the text into list...