Hi,
Does it Not Paging or some behaviour Changes? Like the pageSize differs or something like that, paging was working for me when i tried , i was using dataset and update here , if you still have problem in this code
Regards,
Hari
hey there,
>
>In the FAQ of the DataList there was this Question:
> How to do Paging in DataList?
>I wrote the exact code in my application but the "previous" and "Next" LinkButtons are not working I don''t know why...Here''s the code..Plz anyone try it and tell me wht''s missing??
>
>
>
>
>
>
> <%#DataBinder.Eval(Container.DataItem, "ProductID").ToString()%>
>
> <%#DataBinder.Eval(Container.DataItem, "ProductName").ToString()%>
>
>
>
>
>
>
>
>
>
>
>
>C#
>
>int intStart ;
>
>SqlConnection cn ;
>
>SqlDataAdapter da ;
>
>DataSet ds ;
>
>private void Page_Load(object sender, System.EventArgs e)
>
>{
>
> // Put user code to initialize the page here
>
> if(!Page.IsPostBack )
>
> {
>
> ViewState["Start"] = 0;
>
> bindList();
>
> }
>
>}
>
>
>
>void bindList()
>
>{
>
> cn = new SqlConnection("server=localhost;uid=sa;pwd=;database=northwind");
>
> da = new SqlDataAdapter("Select * from Products ", cn);
>
> ds = new DataSet();
>
> intStart = (int)ViewState["Start"];
>
> ViewState["pageSize"] = 14;
>
> da.Fill(ds, intStart,(int) ViewState["pageSize"], "Table");
>
> DataList1.DataSource = ds;
>
> DataList1.DataBind();
>
>}
>
>
>
>private void lnkPrevious_Click(object sender, System.EventArgs e)
>
>{
>
> intStart = (int) ViewState["Start"] -(int) ViewState["pageSize"];
>
> ViewState["Start"] = intStart;
>
> if (intStart <= 0 )
>
> {
>
> ViewState["Start"] = 0;
>
> }
>
> bindList();
>
>}
>
>
>
>private void lnkNext_Click(object sender, System.EventArgs e)
>
>{
>
> int dlistcount = DataList1.Items.Count;
>
> intStart = (int) ViewState["Start"]+(int) ViewState["pageSize"];
>
> ViewState["Start"] = intStart;
>
> if ( dlistcount < (int)ViewState["pageSize"] )
>
> {
>
> ViewState["Start"] = (int)ViewState["Start"] - (int)ViewState["pageSize"];
>
> }
>
> bindList();
>
>}
>
>
>
>
>