andrewmilner
asked on
c# objectdatasource SelectMethod lost on pagination
I am changing the SelectMethod of an objectDataSource from c# code behind when a search function is run on the page.
This works fine and my gridview populates but once i change the page on the gridview it goes back to the old select method. how can i keep it on this select method.
Any ideas?
Thanks.
This works fine and my gridview populates but once i change the page on the gridview it goes back to the old select method. how can i keep it on this select method.
Any ideas?
Thanks.
we need to see your code....where you are setting your SelectMethod...?
ASKER
The select method is changed when a user enters some info into a text box and presses a button. This then calls a method like
protected void ChangeSelectMethod(object Sender, EventArgs e)
{
MyDataSource.SelectMethod = "MyNewOne"
MyDataSource.DataBind() // do i need to?
GridView1.Bind() // do i need to?
}
This is all well and good and my grid view now has the info in I want but if the user changes page on the gridview then it reverts back to using the original selectmethod.
Any ideas?
which is fine and
protected void ChangeSelectMethod(object Sender, EventArgs e)
{
MyDataSource.SelectMethod = "MyNewOne"
MyDataSource.DataBind() // do i need to?
GridView1.Bind() // do i need to?
}
This is all well and good and my grid view now has the info in I want but if the user changes page on the gridview then it reverts back to using the original selectmethod.
Any ideas?
which is fine and
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bellow url give some information
http://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/data-access/tutorial-04-cs.aspx
http://www.asp.net/(S(pdfrohu0ajmwt445fanvj2r3))/learn/data-access/tutorial-06-cs.aspx
http://samsalisbury.net/articles/objectdatasource-listview-paging-minimal-example/