I want to pass 3 parameters for SelectMethod and 1 parameters for SelectCountMethod of ObjectDataSource.
How can I pass these? And how ObjectDataSource can distinguish which parameters for which methods?
There are two ways of passing parameters to an ObjectDatasource.
1) Through it's wizard you can bind the parameters to various controls, form fields, querystring, session, etc.
2) In it's Selecting event. Example:
protected void Page_Load(object sender, EventArgs e)
{
myObjDs.Selecting += new ObjectDataSourceSelectingEventHandler(myObjDs_Selecting);
}
void myObjDs_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters["someparamname"] = "test";
}
Instead of using selecting event you can also directly add parameters in your button click or anyother function . It must differentiate on the basis of parameter name . I haven't tested it but it shall work.
ObjectDataSource2.SelectParameters.Clear()
ObjectDataSource2.SelectParameters.Add("Parameter1",ValueOfParameter1);