复杂的对象参数传递给ObjectDataSource的选择 [英] Passing complex object parameter to ObjectDataSource Select
问题描述
我使用一个ObjectDataSource,我想传递一个自定义对象的选择参数。
I am using an ObjectDataSource and I would like to pass a custom object as the select parameter.
下面是我的DL方法:
public static Collection<AdminUserEntity> GetUsers(ClientEntity currentClient)
{
}
所以,当我配置我的ObjectDataSource我选择AdminUserEntity为楼内设有商务对象绑定到,然后选择GetUsers的选择方法,但是当你看到它需要一个复杂的类型作为参数,我不知道如何指定使用向导或手动。
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?
推荐答案
看看这篇文章的底部:的 http://msdn.microsoft.com/en-us/library/57hkzhy5(v = VS.80)的.aspx
Take a look at the bottom of this article: http://msdn.microsoft.com/en-us/library/57hkzhy5(v=vs.80).aspx
您将要使用的DataObjectTypeName财产上的ObjectDataSource控件。这将是自定义对象的名称。
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.
这篇关于复杂的对象参数传递给ObjectDataSource的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!