468,247 Members | 1,468 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

Gridview paging problem

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
Apr 19 '07 #1
0 968

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Greg Lyles | last post: by
9 posts views Thread by =?Utf-8?B?c3Jpbml2YXM=?= | last post: by
3 posts views Thread by Marc Grutte | last post: by
2 posts views Thread by antonyliu2002 | last post: by
5 posts views Thread by Andrew Robinson | last post: by
reply views Thread by Don Miller | last post: by
4 posts views Thread by Don Miller | last post: by
4 posts views Thread by Peter | last post: by
reply views Thread by Jeff | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.