Erwin Pombett
asked on
datagrid with checkbox, how to check values after click on a button?
hello experts,
how can i recover the checked values from a datagrid containing checkboxes,
the datagrid is bind to arraylist of objetcs.
my button is not in datagrid,
how can i recover the values when button is clicked?
how can i recover the checked values from a datagrid containing checkboxes,
the datagrid is bind to arraylist of objetcs.
my button is not in datagrid,
how can i recover the values when button is clicked?
ASKER
hello BalkisBr,
thank you for your help,
my problem is that i can not pass Rows in Datagrid, in the following row,
do i have to transtype it? if yes how , i'^ve tried to datagrid...
thank you for your help,
my problem is that i can not pass Rows in Datagrid, in the following row,
do i have to transtype it? if yes how , i'^ve tried to datagrid...
foreach
(
GridViewRow
row
in
GridView1
.
Rows
)
thanks for further help.ASKER
i'm not using a gridview but a datagrid,
ASKER
' Iterating through Rows of a DataGrid
For Each GridItem As DataGridItem In MyDataGrid.Items
' ....
Next
' 1. Getting the Value from a Bound Column in DataGrid
' Get name from Cell(0)
Dim Name As String = GridItem.Cells(0).Text
' 2. Getting the Value of a TextBox Control in DataGrid
' Get text from textbox in Cell(1)
Dim Age As String = CType(GridItem.FindControl ("AgeField "), TextBox).Text
' 3. Getting the Value from CheckBox Control in DataGrid
' Get Checked property of Checkbox control
Dim IsGraduate As Boolean = CType(GridItem.FindControl ("IsGradua teField"), CheckBox).Checked
' 4. Getting the Value from CheckBoxList Web Control in DataGrid
' Get Values From CheckBoxList
Dim Skills As String = String.Empty
Dim CheckList As CheckBoxList = CType(GridItem.FindControl ("CheckBox List1"), CheckBoxList)
For Each Item As ListItem In CheckList.Items
If (Item.Selected) Then
Skills = Skills & Item.Value & ","
End If
Next
Skills = Skills.TrimEnd(",")
' 5. Getting the Value from a RadioButtonList Web Control in a DataGrid
' Get RadioButtonList Selected text
Dim Experience As String = CType(GridItem.FindControl ("RadioBut tonList1") , RadioButtonList).SelectedV alue
' 6. Getting the Value from a DropDownList Web Control in a DataGrid
' Get DropDownList Selected text
Dim Degree As String = CType(GridItem.FindControl ("DropDown List1"), DropDownList).SelectedValu e
For Each GridItem As DataGridItem In MyDataGrid.Items
' ....
Next
' 1. Getting the Value from a Bound Column in DataGrid
' Get name from Cell(0)
Dim Name As String = GridItem.Cells(0).Text
' 2. Getting the Value of a TextBox Control in DataGrid
' Get text from textbox in Cell(1)
Dim Age As String = CType(GridItem.FindControl
' 3. Getting the Value from CheckBox Control in DataGrid
' Get Checked property of Checkbox control
Dim IsGraduate As Boolean = CType(GridItem.FindControl
' 4. Getting the Value from CheckBoxList Web Control in DataGrid
' Get Values From CheckBoxList
Dim Skills As String = String.Empty
Dim CheckList As CheckBoxList = CType(GridItem.FindControl
For Each Item As ListItem In CheckList.Items
If (Item.Selected) Then
Skills = Skills & Item.Value & ","
End If
Next
Skills = Skills.TrimEnd(",")
' 5. Getting the Value from a RadioButtonList Web Control in a DataGrid
' Get RadioButtonList Selected text
Dim Experience As String = CType(GridItem.FindControl
' 6. Getting the Value from a DropDownList Web Control in a DataGrid
' Get DropDownList Selected text
Dim Degree As String = CType(GridItem.FindControl
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window