By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Web DataGrid

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"kpg" <ip***@thereforeiam.com> wrote in message
news:ul**************@TK2MSFTNGP14.phx.gbl...
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;
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


Nov 21 '05 #2

P: n/a
kpg
"CodeMeister" <jw********@codemeister.net> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
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

Nov 21 '05 #3

P: n/a
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.
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.