1

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?

2 Answers 2

1

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";
        }
Sign up to request clarification or add additional context in comments.

Comments

1

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);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.