This is a migrated thread and some comments may be shown as answers.

[Solved] How to get GridCheckBoxColumn values when looping the radgrid

2 Answers 491 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tony Abou-Akl
Top achievements
Rank 1
Tony Abou-Akl asked on 16 Jul 2009, 03:20 PM
I have a simple grid that have 2 GridCheckboxcolumn.I'm trying to loop thru this grid in VB and extract the values for each row, I'm able to get the text value for GridBoundColumn but GridCheckboxcolumn return  

Here is some of my code

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="ResourceId" DataType="System.Guid"

 

 

EmptyDataText="&amp;nbsp;" HeaderText="ResourceId" ReadOnly="True"

 

 

SortExpression="ResourceId" UniqueName="ResourceId" Visible="false">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridCheckBoxColumn DataField="Invited" DataType="System.Boolean"

 

 

HeaderText="Invited" ReadOnly="False" SortExpression="Invited"

 

 

UniqueName="Invited">

 

 

</telerik:GridCheckBoxColumn>

 

 

<telerik:GridBoundColumn DataField="Name" EmptyDataText="&amp;nbsp;"

 

 

HeaderText="Name" ReadOnly="True" SortExpression="Name" UniqueName="Name">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Title" EmptyDataText="&amp;nbsp;"

 

 

HeaderText="Title" ReadOnly="True" SortExpression="Title" UniqueName="Title">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Location" EmptyDataText="&amp;nbsp;"

 

 

HeaderText="Location" ReadOnly="True" SortExpression="Location"

 

 

UniqueName="Location">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Response" DataType="System.String"

 

 

EmptyDataText="&amp;nbsp;" HeaderText="Response" ReadOnly="True"

 

 

SortExpression="Response" UniqueName="Response">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridCheckBoxColumn DataField="Attended" DataType="System.Boolean"

 

 

HeaderText="Attended" ReadOnly="True" SortExpression="Attended"

 

 

UniqueName="Attended">

 

 

</telerik:GridCheckBoxColumn>

 

 

 

</Columns>

 

 

 


VB code

 

 

For Each grdItem In RadGrid1.MasterTableView.Items
    ' to get Name value

 

 

    sName = grdItem("Name").Text
    
'How can i get the value for Invited Grid CheckboxColumn so i can set another checkbox to read only
Next

Your help is greatly appreciated

 

 

 

Thanks Tony
 

 

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jul 2009, 05:17 AM
Hi Tony,

Try the following code snippet in order to access the checkbox values.

VB:
 
Protected Sub Button1_Click(ByVal sender As ObjectByVal e As EventArgs) 
    For Each item As GridDataItem In RadGrid1.MasterTableView.Items 
        ' Get the checkbox value for the row 
        Dim chk As CheckBox = DirectCast(item("MartalStatus").Controls(0), CheckBox) 
        Dim value As Boolean = chk.Checked 
        Response.Write(value) 
    Next 
End Sub 

-Shinu.
0
Tony Abou-Akl
Top achievements
Rank 1
answered on 17 Jul 2009, 02:18 PM
Hi Shinu

Thanks for the help, it did work.
Tags
Grid
Asked by
Tony Abou-Akl
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Tony Abou-Akl
Top achievements
Rank 1
Share this question
or