views:

85

answers:

0

I was added the DataPager Control inside Listview. There is no problem while displaying the data. But When I click the Next page button I m getting error.

Error: The Select operation is not supported by ObjectDataSource 'ObjectDataSource2' unless the SelectMethod is specified.

protected void Page_Load(object sender, EventArgs e)
        {

        if(!IsPostBack)      
        FillGrid();
        }

        private void 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.QueryString["period"]));
            ObjectDataSource2.TypeName = "Online.Lib.Invoice";

        }

CodeBeside:

<asp:ListView ID="ListView1" runat="server" DataSourceID="ObjectDataSource2">
       <LayoutTemplate>            
                <asp:DataPager ID="DataPager1" PagedControlID="ListView1"   runat="server">
                <Fields> 
               <asp:NumericPagerField ButtonCount="10" />       
               <asp:NextPreviousPagerField FirstPageText="İlk" LastPageText="Son" NextPageText="İleri" PreviousPageText="Geri" />
              </Fields>
                </asp:DataPager>                                                  
            </LayoutTemplate>  
   </asp:ListView>