1

I am using an ObjectDataSource and I would like to pass a custom object as the select parameter.

Here is my DL method:

public static Collection<AdminUserEntity> GetUsers(ClientEntity currentClient)
{
}

So when I configure my ObjectDataSource I choose the AdminUserEntity as the buisness object to bind to and then choose GetUsers as the Select method but as you see it takes a complex type as a parameter and I don't know how to specify this using the wizard or manually.

After some more digging I found this solution:

protected void ods_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
     ClientEntity currentClient = ClientEntity.GetClient("abc");
     e.InputParameters["currentClient"] = currentClient;
}

Are there any other ways to accomplish this or is this a good solution?

1 Answer 1

2

Take a look at the bottom of this article: http://msdn.microsoft.com/en-us/library/57hkzhy5(v=vs.80).aspx

You'll want to use the DataObjectTypeName property on the ObjectDataSource control. This will be the name of the custom object.

Either solution should work just fine.

Sign up to request clarification or add additional context in comments.

2 Comments

This works. I was getting confused between the TypeName and the DataObjectTypeName property. Thank-you.
@tdean I feel you, I did the same mistake

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.