Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey there,
I got a very simple situation but apparently missing something out.

I have a grid with 3 columns in telerik radGrid. 1st column is checkbox - simple asp checkbox. What I need to get is when I check the checkbox I need to take the value from another column and store it in hidden variable.

Anyone have a clue how to get this done?

P.S.: I succeeded to do the same with clicking on grid row with this:
C#
var grid = sender;
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
var cell1 = MasterTable.getCellByColumnUniqueName(row, "RowUniqueName");


But this was easy as the event was set in
JavaScript
<ClientEvents />


Any suggestion about the checkbox would be appreciated :)

Thanks!
Posted

Telerik documentation sucks so I found out a better way of doing this without writing tons of code:

XML
<ItemTemplate>
    <asp:CheckBox
    ID="cb_Selected"
    Enabled="true"
    runat="server"
    onclick='<%# "cbClicked(\"" + Eval("ValuesFromDataSource") + "\", this);"/>
</ItemTemplate>

And the JS code would like this:
function cbClicked(key, chk) {
     // Key is the value I needed
     // chk is checkbox so I can check if it's checked or not chk.checked = True/False
}

So - this was way much cleaner code then examples and demos in telerik.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900