-1

i have a RadGrid and it has a template column which contains a asp:CheckBox and a label , so label has a "for" Attribute which the value is equal to the ID of the CheckBox so i want to set the CheckBox ID to the "for" attribute for the label this scenario is to change the style of checkbox to Material Design of Google, and my asp.net is C# , i did this scenario in VB language i want to do it in C# and that's the code that i have did in VB and Works Great ==>

<telerik:GridTemplateColumn AllowFiltering="false">
                        <ItemTemplate>
                            <asp:CheckBox ID="cbxSelect" runat="server" onClick="checkboxClicked(event, 'cbxSelect')"></asp:CheckBox>
                            <label for="<%# DirectCast(Container, GridViewRow).FindControl("cbxSelect").ClientID %>"></label>
                        </ItemTemplate>
</telerik:GridTemplateColumn>

Any Idea?

NoobMaster
  • 27
  • 13
  • DirectCast does not have a equiv. in C#, you can check into this thread:http://stackoverflow.com/questions/2683847/cs-equivalent-to-vb-nets-directcast – Kevin Raffay Apr 17 '17 at 19:04
  • This may also work: ((GridViewRow)Container).FindControl("cbxSelect").ClientID – Kevin Raffay Apr 17 '17 at 19:05
  • @KevinRaffay Your Solution Worked like a charm, you are awesome you saved my date, just if u can post the above answer so i can marked as Answered thank you. – NoobMaster Apr 17 '17 at 19:20

1 Answers1

0

This may also work: ((GridViewRow)Container).FindControl("cbxSelect").ClientID

Kevin Raffay
  • 842
  • 5
  • 18