Web DataGrid

  • Thread starter Thread starter kpg
  • Start date Start date
K

kpg

Hi all,

First, let me tell you I am confused by the different choices of
newsgroups. I see no newsgroups that deal with webapps and
winapps differently, but I see them as two very different things
even if the language is vb.net.

Anyway, I have a Web App DataGrid question. It should be simple.

Drop a datagrid on a web form, set datasource, call databind, it works.
Set AllowPaging, set up the page change event as follows:
dgPolicies.CurrentPageIndex = e.NewPageIndex

dgPolicies.DataBind()

When I click on a 'page' link my code is run but I see NOTHING!

How can I get the control to re-display itself with the next page data????

TIA

kpg
 
kpg said:
Hi all,

First, let me tell you I am confused by the different choices of
newsgroups. I see no newsgroups that deal with webapps and
winapps differently, but I see them as two very different things
even if the language is vb.net.

Anyway, I have a Web App DataGrid question. It should be simple.

Drop a datagrid on a web form, set datasource, call databind, it works.
Set AllowPaging, set up the page change event as follows:
dgPolicies.CurrentPageIndex = e.NewPageIndex

You need to get the data to bind to in your code. Calling DataBind without
specifying the DataSource property results in an empty grid.

dgPolicies.DataSource = myDataSource;
 
You need to get the data to bind to in your code. Calling DataBind without
specifying the DataSource property results in an empty grid.

No, sorry, that does not work.

I set the datasource in the page load event and the grid displays just
fine. Even if I reset the datasource in the page change event I still
get a blank page after I click one of the navigation buttons.

Now I don't re-query the datatable that I use as a datasource, I just
re-assign the one I queried in the page load event.

Do I have to requery the database again? That does not seem right.
If I were going to do that I would just through away the grid and do
it myself.

Below is my code. I added the session variable just to test the need
to re-set the data source.

<page load>
'code to load dtDataDtable
Session("MyTable") = dtDataTable
dgPolicies.DataSource = dtDataTable
dgPolicies.DataBind()
<\page load>

<page change>
dgPolicies.DataSource = Session("MyTable")
dgPolicies.CurrentPageIndex = e.NewPageIndex
dgPolicies.DataBind()
<\page change>

the above code results in a blank page after navigating to the
next page of the data grid (it has 23 pages).

???
kpg
 
Nervermind...

After playing around with the sorting I had created a new
session variable to hold the DataView and when I set that
in the Page change event it does work. I reverted to the
datatable and it also works...

thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top