hi,
i have a GridTemplateColumn in Radgrid. In the <EditItemTemplate> i have a radcombo. When fire the event radcombo1_SelectedIndexChanged
i need to access to another GridTemplateColumn like this:
<telerik:GridTemplateColumn HeaderText="Annul." UniqueName="flg_ann">
<ItemTemplate>
<asp:CheckBox id="CheckBoxFlgAnnul" runat="server" Checked='<%# Eval("flg_ann") %>'></asp:CheckBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
........rcbStatoRecUpd_SelectedIndexChanged(.......)
Dim radcombo As RadComboBox = CType(sender, RadComboBox)
Dim editedItem As GridEditableItem = TryCast(radcombo.NamingContainer, GridEditableItem)
Those firsts two line of code work well BUT after no way to access to CheckBox column. i try findcontrol in all possible way but i got alway error "object no reference" ecc ecc I also try Dim item As GridDataItem = DirectCast(combo.NamingContainer, GridDataItem) but nothing to do. no way.
Question : there is a way to access to that column or not ?
TY, Maurizio
6 Answers, 1 is accepted
The CheckBox from the CheckBoxColumn can be accessed as follows:
Protected
Sub
RadComboBox1_SelectedIndexChanged(sender
As
Object
, e
As
RadComboBoxSelectedIndexChangedEventArgs)
Dim
radcombo
As
RadComboBox =
DirectCast
(sender, RadComboBox)
Dim
editedItem
As
GridEditableItem = TryCast(radcombo.NamingContainer, GridEditableItem)
Dim
cell
As
TableCell = editedItem(
"SomeBool"
)
Dim
checkBox
As
CheckBox = TryCast(cell.Controls(0), CheckBox)
End
Sub
More information can be found in the Accessing Controls in Edit/Insert Mode article.
Here is a screencast demonstrating the behavior of the attached project.
Regards,
Peter Milchev
Progress Telerik

dear Peter, no way. i know it's hard try to explain in other language some problem.
the combo is in a template column inside <EditItemTemplate>. ok? i would like to know (if possible) to access to another template column but this control ( label, check or whatever) IS INSIDE < <ItemTemplate>. i need that value. combo is edit mode ,other control is item mode. so the question is : it's possible or not ? Maybe is not possible...i dont know or if is possible how to do ?
i hope to be clear.
Bye Peter and ty anyway for your responce.
Please find attached the modified sample project that gets a reference to a RadCheckBox which is in ItemTemplate in another template column.
If that is not your scenario, would you please modify the attached project so that it represents your case and send it back to us? We would greatly appreciate it if you provide us more details and specific examples on the desired result. For example, "in the SelectedIndexChange of the ComboBox in edit template of ShipCountry column, I would like to access the CheckBox in the item template of SomeBool column".
Regards,
Peter Milchev
Progress Telerik

Hello Peter , maybe i uderstood where is the problem...first i cant use the RADCHECKBOX because there is an error that say "is not a know element"...anyway if i use your code and i change radcheckbox with <asp:Label ALL WORK WELL. IF i try to use GridCheckBoxColumn i have an error, if i use asp:checkbox i have error. So i guess problem is database field. In Oracle dont exist boolen type, i have integer type with two value 0 or 1. when i linked this database field with asp:checkbox ALL WORK but i cannot
access that value from RadComboBox1_SelectedIndexChanged That stay in edittemplate. try to change yuor project and use and asp:checkbox linked to an integer and maybe we discover if this is problem. Ty for your time. Maurizio

Hi Peter i found solution.
<telerik:GridTemplateColumn HeaderText="Annul." AllowFiltering="false" UniqueName="flg_ann" SortExpression="flg_ann" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="30px">
<ItemTemplate>
<asp:CheckBox ID="cbxFLAG_ANNULL" runat="server" Checked='<%# IIf(Eval("flg_ann"), "True", "False") %>' />
</ItemTemplate></telerik:GridTemplateColumn>
Using that syntax Checked='<%# IIf(Eval("flg_ann"), "True", "False") %>' ALL WORK using the code u give me :
Dim cell As TableCell = editedItem("someField")
Hope this solution help other user.
Best Regards
Maurizio Brusini
Thank you for sharing your specific solution and experience in this case with our community. I hope it will prove to other developers as well.
Regards,
Eyup
Progress Telerik