我有两个 Asp.net ListView 控件绑定到两个不同的 ObjectDataSource 控件。每个 ODS 控件引用“MethodA”和“MethodB”。
我希望“MethodA”调用数据库并返回“MethodA”和“MethodB”的数据。
我总是可以让“MethodB”再次调用数据库,但这不会有效。
我不确定实现这一目标的最佳方法。
[DataObjectMethod(DataObjectMethodType.Select)]
public List<int> MethodA(int input)
{
List<int> a = new List<int>();
List<string> b = new List<string>();
///
/// Make one call to database
/// returns: List<int> and List<string>
/// set 'a' and 'b' values.
return a;
}
[DataObjectMethod(DataObjectMethodType.Select)]
public List<string> MethodB()
{
List<string> b = new List<string>();
///
/// When MethodA is called set 'b'
///
return b;
}