Link to home
Start Free TrialLog in
Avatar of andrewmilner
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.
Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

we need to see your code....where you are setting your SelectMethod...?
Avatar of andrewmilner
andrewmilner

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
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial