Gridview paging problem

N

news.ipartners.pl

Hello,

I've run across problem with paging in gridview.
I have 2 elementson my web page - drop down list filled with manufacturers
and grid view for displaying data connected with certain manufacturer. For
test purposes I've set PageSize property of gridview to 5.
When I am loading page I initialy fill gridview with first manufacturer on
the list (this manufacturer have i.e. 9 records in database).
As far I can use paging mechanism.
Now I'am changing manufacturer on drop down list to second one, which fills
grid view with second manufacturer. This manufacturer have 12 records in
database what gives 3 pages. First page works like a charm, but from now on
everything goes wrong.
If I choose next page it gives me results form second page of first
manufacturer! I can go back to first page, but it also shows results from
first manufacturer.


here is my code for displaying manufacturer on page load event:

strSQL="select * from mf where id_mf=" + DDL_mf.Items[0].Value.ToString();
cmdSQL.Commandtext=strSQL;
cmdSQL.Connection=connSQL;
sdaSQL.SelectCommand=cmdSQL;
sdaSQL.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();

and code from DDL_mf_SelectedIndexChanged:
strSQL="select * from mf where id_mf=" + DDL_mf.SelectedValue;
cmdSQL.Commandtext=strSQL;
cmdSQL.Connection=connSQL;
sdaSQL.SelectCommand=cmdSQL;
sdaSQL.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();

Please help ... :)
Krzysztof Stefan
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top