Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How do you save a dynamic datagrid to viewstate?

Reply
Thread Tools

How do you save a dynamic datagrid to viewstate?

 
 
Burak Gunay
Guest
Posts: n/a
 
      06-08-2006
Hello,

I have a datagrid on my aspx page without any column definitions.

<asp:datagrid id="dtgValues" style="Z-INDEX: 101; LEFT: 2px; POSITION:
relative" Runat="server" PageSize="10" AutoGenerateColumns="False">

I create the columns and the data dynamically in the code behind
depending on which table the user selected.

When I postback the page, I load the grid again.

If you just use regular paging, and bind the whole dataset to the
datagrid, then paging works.

But when i try to use custom paging i run into problems.

on postback page_load, I load the data again by calling FillGrid()
function
, but then when the PageIndexChanged event gets executed,

Private Sub dtgValues_PageIndexChanged( source , e )
' Set the CurrentPageIndex before binding the grid
dtgValues.CurrentPageIndex = e.NewPageIndex
FillGrid()
End Sub

I end up with two datagrids next to each other.

Is there a way around this?

How can I save the datagrid in viewstate and load it again on the
postback?

Thanks,

Burak

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How can I save the style of a datagrid so that it appears on the automatic format to use iin another datagrid? Luis Esteban Valencia ASP .Net Datagrid Control 1 11-25-2004 08:05 AM
prompt user to save changes in datagrid editmode when they try to navigate away from page...how do you do that? tafs7 ASP .Net Datagrid Control 2 02-06-2004 02:48 AM
prompt user to save changes in datagrid editmode when they try to navigate away from page...how do you do that? tafs7 ASP .Net Web Controls 2 02-06-2004 02:48 AM
prompt user to save changes in datagrid editmode when they try to navigate away from page...how do you do that? tafs7 ASP .Net Building Controls 2 02-06-2004 02:48 AM



Advertisments