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

[Solved] Accessing other Columns values based on a TemplateCheckBox Column

2 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 20 Aug 2009, 12:24 AM
Hi,

Unfortunatelly this is related to a previous post of mine but its a different issue I am having now, so I decided to create a new thread.

I have a Radgrid with 3 hierarchy Grids which is made completely in the Code Behind using C#.  I have binded a RadtoolBar to the grid and created Column template based on a checkBox.

My application is suppossed to do the following:

1.Load a grid with new information from our new customers.
2.The hierarchy grids loads additional customer data, the products he has browsed, and the third hierarchy grid loads accounts from our database which share similar info with our new customer, so we can eventually disable these duplicate accounts.
3. The main grid and the third hierarchy grid have a checkbox column from a column template which on the customer side can be checked and disabled after the disable button from the radtoolbar has been pressed.

These two previous points I have been able to do.

Working on the third point has caused me alot of problems. In the checkbox template I was passing the customer id in the in the checkbox.id value, then via javascript I was navigating through all the checkbox inputs and determining which one was checked, then I would concatenate the customer ids into a hidden field, force a __doPostBack and disable the accounts, which worked great.

But this is my problem, when I expand the hierarchy grid with the duplicates, the names of the checkbox controls reset to a standard clientid and don't reload the id I had put in there before, so if I click a checkbox in the main grid the value is not passed, but in the hierarchy grid the value is passed, so it is one for another bassically...

One of the columns of the grid has the client Id, is it possible for me to determine which checkbox is checked from the grid and the hierarchy grid, then get the client Id, so I can disable the account?

Please let me know.
Thanks.

2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 21 Aug 2009, 10:55 AM
Hello Daniel,

Thanks for the detailed description. Here is a suggestion. Whenever you click on a checkbox in the template column, you can reach to your row's datakey value and save it in a hidden variable on the page.

Back on the server, you can parse your hidden variable value and you will have all the selected item DataKeyValues.

You can find attached a sample web page I have created to demonstrate this. I use RadGrid's client-side API to get to my client-side GridDataItem object (thisDataItem) and get its data key value ID.

For the sake of the example, I have used an ASP:TExtBox control to save my values, but you can just as well use an <input type="hidden" runat="server"> element with the same ID.

Best wishes,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Daniel
Top achievements
Rank 1
answered on 24 Aug 2009, 03:59 PM
Thanks for the help, made the changes and works like a charm.
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Veli
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or