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

Trying to pass client information to OnNeedDataSource event

1 Answer 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 25 Jun 2013, 07:09 PM
I have an asp:FormView on my page along with a Telerik RadGrid next to it.  On the form view is the parent object information that has a checkbox.  In my RadGrid I change the column headers based on whether this checkbox in the FormView is checked.  This works fine when the grid is loading initially.  I've also added jQuery to the page so that when the checkbox is checked on the client side without saving the column headers are changed.

My problem is when a new row is added to the grid or the refresh button is clicked an ajax call is made back to the server to get the parent object.  If the checkbox has been checked on the client side, and not saved to the server, my column headers are now wrong.

How can I send back to the server whether or not that checkbox is checked on the client side even though the parent data hasn't been saved to the server? 

I thought about possibly sending the value accross in the OnNeedDataSource event, but I don't see a way to do that.

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 28 Jun 2013, 11:00 AM
Hi Ben,

There are two ways you can send to the server a certain value that will help you in executing the logic correctly. The first approach is to fire the AJAX request using the ajaxRequest method as demonstrated here. Another option for you would be to use a hidden field and when a check box is checked on the client set it's value. Later using server-side logic you can extract the value needed.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or