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

OnNeedDataSource firing twice

2 Answers 250 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 2
Chris asked on 03 Jul 2009, 09:50 AM
I'm just starting to demo the RadGrid and decided to copy the example from:-
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/slider/defaultcs.aspx

I pasted in the sample code from the DefaultCS.aspx and DefaultVB.aspx.vb sections.  I did some slight modifications so I was calling data from our own database and ran the project.  I noticed in SQL Server profiler that my query was being called twice everytime I used the page slider.  After looking at the sample code that I pasted in I noticed that if I remove:-

OnNeedDataSource="RadGrid1_NeedDataSource"

... from the HTML (DefaultCS.aspx) if only fires once.  Everything still seems to work fine still.  Is this a mistake in your sample and is it not required or have I maybe done something wrong when I cut and pasted the sample code into our application?  I am just checking that removing this from the HTML will not have any implications.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 06 Jul 2009, 03:59 PM
Hello Chris,

The described behavior is not mistake caused of the implementation of the example. To get correctly working demo you need to copy mark-up code from the DefaultVB.aspx, and not from the DefaultCS.aspx.

The NeedDataSource event is fired twice in the VB.NET, because the grid is attached twice to this event. Hence you do not need to wire the event in the mark-up code.

Please examine once again the online demo (please choose DefaultVB.aspx page from the drop down menu in the example), which you point in your previous post.

Kind regards,
Georgi Krustev
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
Chris
Top achievements
Rank 2
answered on 08 Jul 2009, 11:20 AM
Thanks Georgi, I'll remove the OnNeedDataSource="RadGrid1_NeedDataSource" from the DefaultCS.aspx so I'm only wiring it up once.

Chris
Tags
Grid
Asked by
Chris
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Chris
Top achievements
Rank 2
Share this question
or