c# - Listview DataPager with ObjectDataSource problem -
The dataPager control was added to me within the list. There is no problem while displaying the data but when I click on the next page button, I get an error.
Error: The operation selected by object data source 'ObjectDisource Source 2' is not supported, unless the selection method is specified.
Protected Zero Page_Old (Object Sender, EventArgues E) {if (! IPOB) filgrids (!); } Private Zero FillGrid () {user user = new user (); User = (user) HttpContext.Current.Session ["Login"]; ObjectDataSource2.SelectMethod = "GetDetails"; ObjectDataSource2.SelectParameters.Add ("Customer_ID", DbType.Int32, Convert.ToString (user.Customer_ID)); ObjectDataSource2.SelectParameters.Add ("Selected_Period", DbType.String, Convert.ToString (Request.JQueryString ["Duration"])); ObjectDataSource2.TypeName = "online.lib.translation"; }
Codebeside:
& lt; ASP: LISTviewview ID = "LISTVIEW 1" run = "server" Datasource ID = "ObjectDatabase 2" & gt; & Lt; LayoutTemplate & gt; & Lt; Asp: DataPager ID = "DataPager1" PagedControlID = "ListView1" runat = "Server" & gt; & Lt; Fields & gt; & Lt; Asp: NumericPagerField Button Count = "10" /> & Lt; ASP: Next Previous Page Pagerfield FirstPagetext = "İlk" Last Page Lesson = "Son" Next Page Lesson = "İleri" Previous Page Lesson = "Gary" /> & Lt; / Fields & gt; & Lt; / ASP: DataPager & gt; & Lt; / LayoutTemplate & gt; & Lt; / ASP: ListView & gt;
OK your FillGrid () works well and you can get it from page_load routine Can load data. When you click on the "Next page" of ListView, you are postbanking.
if (! IsPostBack) FillGrid (); }
.. This means that the Fillgrid () is not loaded (which is the ObjectDataSource, the selection is the instruction). What can I see in the above code snippet? IsPostBack is quite common to make such a mistake in handling.
Comments
Post a Comment