Datagrid paging without using viewstate

Datagrid paging without using viewstate

Post by Ibai Pe? » Fri, 14 Mar 2003 02:28:24



Dear all,

I need to page a datagrid, but without viewstate.
If I just turn off viewstate, the DataGrid doesnt appear, although I make a
DataBind.
I have seen that when I click a page number, the PageIndexChanged event is
not fired when viewstate is turned off(when viewstate is on, works fine)
Any help, hint, etc. would be apreciated.

Here is my codebehind:

private void Page_Load(object sender, System.EventArgs e)
{
    if (!IsPostBack)
    {
        FillDataGrid();
        AsignView();
        DataGrid1.DataBind();
    }
    else
    {
        AsignView();
        DataGrid1.DataBind();
    }

Quote:}

public void AsignView()
{
    DataGrid1.PageSize = 5;
    DataGrid1.DataSource = new DataView(DSData.Tables["DataTable"]);
Quote:}

private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
    DataGrid1.CurrentPageIndex=e.NewPageIndex;
    AsignarVista();
    DataGrid1.DataBind();

Quote:}

Ibai Pe?a
 
 
 

Datagrid paging without using viewstate

Post by solution » Fri, 14 Mar 2003 08:16:53


Your DataGrid1_PageIndexChanged mthod calls a method "AsignarVista()". This
should probably be "AsignView()"...

cheers....B


Quote:> Dear all,

> I need to page a datagrid, but without viewstate.
> If I just turn off viewstate, the DataGrid doesnt appear, although I make
a
> DataBind.
> I have seen that when I click a page number, the PageIndexChanged event is
> not fired when viewstate is turned off(when viewstate is on, works fine)
> Any help, hint, etc. would be apreciated.

> Here is my codebehind:

> private void Page_Load(object sender, System.EventArgs e)
> {
>     if (!IsPostBack)
>     {
>         FillDataGrid();
>         AsignView();
>         DataGrid1.DataBind();
>     }
>     else
>     {
>         AsignView();
>         DataGrid1.DataBind();
>     }
> }
> public void AsignView()
> {
>     DataGrid1.PageSize = 5;
>     DataGrid1.DataSource = new DataView(DSData.Tables["DataTable"]);
> }
> private void DataGrid1_PageIndexChanged(object source,
> System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
> {
>     DataGrid1.CurrentPageIndex=e.NewPageIndex;
>     AsignarVista();
>     DataGrid1.DataBind();
> }

> Ibai Pe?a


 
 
 

Datagrid paging without using viewstate

Post by Ibai Pe? » Fri, 14 Mar 2003 16:22:18


Sorry, I mixed. Off course my code says AsignView(). Thats not the error.
The question is why the PageIndexChanged doesnt get fired when
enableviewstate is set to false?

Hope you can help me,

Ibai Pe?a



> Your DataGrid1_PageIndexChanged mthod calls a method "AsignarVista()".
This
> should probably be "AsignView()"...

> cheers....B



> > Dear all,

> > I need to page a datagrid, but without viewstate.
> > If I just turn off viewstate, the DataGrid doesnt appear, although I
make
> a
> > DataBind.
> > I have seen that when I click a page number, the PageIndexChanged event
is
> > not fired when viewstate is turned off(when viewstate is on, works fine)
> > Any help, hint, etc. would be apreciated.

> > Here is my codebehind:

> > private void Page_Load(object sender, System.EventArgs e)
> > {
> >     if (!IsPostBack)
> >     {
> >         FillDataGrid();
> >         AsignView();
> >         DataGrid1.DataBind();
> >     }
> >     else
> >     {
> >         AsignView();
> >         DataGrid1.DataBind();
> >     }
> > }
> > public void AsignView()
> > {
> >     DataGrid1.PageSize = 5;
> >     DataGrid1.DataSource = new DataView(DSData.Tables["DataTable"]);
> > }
> > private void DataGrid1_PageIndexChanged(object source,
> > System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
> > {
> >     DataGrid1.CurrentPageIndex=e.NewPageIndex;
> >     AsignarVista();
> >     DataGrid1.DataBind();
> > }

> > Ibai Pe?a

 
 
 

1. Anyone found a solution to Paging a DataGrid without Viewstate?

I've run a search in these groups and I noticed a lot of people
posting about problems, but I haven't seen anyone post a solution.

Has anyone posted a complete solution yet, or found a link with one?

I know I can make the first 10 pages appear properly without the
ViewState Enabled, but I can't make the other pages appear properly.
The JavaScript created by ASP.NET is "wrong".

Anyone has a link to examples?

Thank you!

- Patrick Carroll

2. A Panasonic KX-P2123 Printer Problem...

3. Custom DataGrid Paging and Sorting without viewstate

4. Image Cache Issue

5. Paging through records without using a datagrid

6. specials and emtex

7. Using selection without ViewState (Updated)

8. Slow server, but it beats 2195 , 2600 .net

9. Using selection without ViewState

10. Login Page creation in ASP.NET using C# (without using the Login Control)

11. Datagrid can't work without VIEWSTATE ?

12. Can DataGrid sort without viewstate enabled

13. Datagrid ButtonColumn Without ViewState