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

OnNeedDataSource Firing twice

3 Answers 161 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charles Faramarzi-rad
Top achievements
Rank 1
Charles Faramarzi-rad asked on 07 Jun 2010, 08:49 PM
I can't seem to find any good documentation as to why this behavior is happening.  I have a a list view that is using the onneeddatasource functionality.  I use this to take care of the paging and sorting functionality of the control.
 <telerik:RadListView AllowNaturalSort="true" ID="RadListView1" runat="server" Skin="Windows7" 
                                    AllowPaging="True" onneeddatasource="RadListView1_NeedDataSource"
                               

and the event handler
  protected void RadListView1_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e) 
        { 
            getIAListData(); 
        } 

However, the method getIAListData() get called twice when i step through the code.  Why is that?  please tell me that this is not a designed behavior or that I will have to override and create custom paging methods.

thanks
Charles

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 08 Jun 2010, 09:24 AM
Hello Charles,

I am not sure if I understand your problem correctly, but when Sort/Page commands are triggered RadListView requires to re-bind in order to process the command.
You can find list of commands the call rebind implicitly on the article bellow:
http://www.telerik.com/help/aspnet-ajax/listview-commands-invoking-rebind-implicitly.html

Kind regards,
Nikolay
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
Charles Faramarzi-rad
Top achievements
Rank 1
answered on 08 Jun 2010, 05:14 PM
HI Nikolay;
Thank you for responding back. I'm sorry for not explaining myself more clear.  Here is the list of events that happen in order.

I've put breakpoints on all the methods in my class.
when i press f5 and step through the code here is the outputs.
1.  protected void Page_Load(object sender, EventArgs e) (which is normal)
2.  protected void RadListView1_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
        {
            getIAListData();
        }
//This method only gets called, where as I do have two other OnNeedDataSource methods for two other RadGrid controls, however, they do not get called.

3.after stepping through , this method gets called again
protected void RadListView1_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
        {
            getIAListData();
        }

This is where I'm having my issue with this control. Why is this getting called twice in a row?


I hope I'm making sense.

thanks
Charles
        
0
Nikolay Rusev
Telerik team
answered on 11 Jun 2010, 01:44 PM
Hello Charles,

For your convenience I am attaching sample page using RadListView bound with NeedDataSource and RadDataPager. Can you please try replicating the behavior on that page?

Regards,
Nikolay
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.
Tags
Grid
Asked by
Charles Faramarzi-rad
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Charles Faramarzi-rad
Top achievements
Rank 1
Share this question
or