0
votes

I have an asp.net radgrid that contains a column thusly:

<telerik:GridTemplateColumn UniqueName="RenewsContainer" HeaderText="Renews" HeaderStyle-Width="60px" ItemStyle-Width="60px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
   <ItemTemplate>
      <asp:CheckBox ID="chkRenewsView" runat="server" Checked='<%#Eval("Renews")%>' onclick="checkboxChange(this);" />
   </ItemTemplate>
   <EditItemTemplate>
      <asp:CheckBox ID="chkRenews" runat="server" Checked='<%# Bind("Renews") %>' />
   </EditItemTemplate>
</telerik:GridTemplateColumn>

Notice the onclick="checkboxChange(this). This works fine, but inside that checkBoxChange() function I need to access the checkbox state (checked/unchecked) of a sibling GridCheckBoxColumn checked state. I don't know how to get the row index (or rowid) of the checked row, and even when the row is obtained, I don't know how to get the checked state of that GridCheckBoxColumn (uniquename: "Locked").

Seems like there could be 2 approaches to this, at least:

  1. Inside the checkboxChange() function, pass as an arg the current row index or telerik rowid. I don't know how to get this.
  2. Inside the js function, somehow determine the row index or rowid of the row containing the checkbox that was clicked.

And then once the rowid/rowidx is obtained, how to get that sibling checked state?

Any ideas?

1

1 Answers

0
votes

Couldn't you give your checkbox a unique CssClass and then use jQuery to select it right out of the DOM? The RadGrid is a programmatic wrapper, but if you inspect the rendered HTML it's just a DIV/Table like anything else.

    <ItemTemplate>
      <asp:CheckBox ID="chkRenewsView" runat="server" CssClass="MyCheckBox" Checked='<%#Eval("Renews")%>' onclick="checkboxChange(this);" />
   </ItemTemplate>

//jQuery
var isChecked = $(".MyCheckBox").is(':checked');