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

how to call NeedDataSource event?...

4 Answers 1422 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 08 Nov 2010, 08:11 AM
Hey everyone,

I have a RadGrid with which i am using Advance Data binding using NeedDataSource Event.I have form template inside asp panel for inserting and editing into grid.Panel consists of 2 buttons save and cancel.On save button the items actually got inserted or edited in the grid but are'nt visible until i load the whole form again(debugging it again..!!).I mean i want the grid to be reloaded on every insert,delete or update,which is not happening.Do i have to call this event every time i perform a manual insert or update?....

Thanks
Amit

4 Answers, 1 is accepted

Sort by
0
Accepted
Radoslav
Telerik team
answered on 09 Nov 2010, 03:06 PM
Hi Amit,

To achieve the desired functionality you could try calling the RadGrid.Rebind() method after insert, delete or update. The Rebind() method will force the RadGrid to fire NeedDataSource event then calls DataBind.
Please give it try and let me know if it helps you.

Greetings,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Amit
Top achievements
Rank 1
answered on 10 Nov 2010, 05:35 AM
thanks Radoslav ,that worked..
0
Levi
Top achievements
Rank 1
answered on 15 Oct 2013, 07:49 PM
This only works if you haven't already done a rebind in the same page lifecycle. This causes problems for me because I have to rebind on every request now due to the new version of telerik. The grid breaks anytime you do a page lifecycle and don't rebind even if no data has changed. Then when I actually change data and try to rebind, it won't get fired. I shouldn't have to rebind the grid on every request. This forces me to handle every type of postback differently and decide when to rebind the grid based on whether or not I need to update the grid. 
0
Radoslav
Telerik team
answered on 18 Oct 2013, 08:35 AM
Hi Levi,

You do not need to rebind the RadGrid on every page load, except for the case when you add new records to the database with external form on every post back. Could you please share your aspx markup code with the related code behind file? Thus we will be able to gather more details about your scenario and provide you solution in which the RadGrid does not need rebind on every postback.

Looking forward for your reply.

Regards,
Radoslav
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
Amit
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Amit
Top achievements
Rank 1
Levi
Top achievements
Rank 1
Share this question
or