ObjectDataSource 数据绑定:在 Select 方法调用之后获取对象属性
我正在使用 ObjectDataSource 控件来调用 MapInfo 对象。该对象有两个属性:
- public IList 访问
- public int TotalAvailable
select 方法返回一个 IList,但也会填充 TotalAvailable 属性。我已将 ObjectDataSource 中的 TypeName 设置为 MapInfo 对象,但因为 Select 方法仅返回 IList,所以我无权访问 TotalAvailable。
[DataObject(true)]
public sealed class MapInfo
{
private IList<Visit> visits;
private int totalCount;
public IList<Visit> Visits
{
get
{
if (visits == null)
visits = new List<Visit>();
return visits;
}
set
{
visits = value;
}
}
[DataObjectMethod(DataObjectMethodType.Select)]
public IList<Visit> GetAccountVisits(DateTime startdate, DateTime enddate, string orgids, int reportlevel,
string username, int authlevel, bool visited, bool notvisited, string accounttypeid)
{
有
什么方法可以访问这个值。我知道它正在填充到 MapInfo 对象中,但从 Select 方法返回的所有内容都是 IList
I am using an ObjectDataSource control to call a MapInfo object. This object has two properties:
- public IList Visits
- public int TotalAvailable
The select method returns an IList but the TotalAvailable property is also populated. I have set the TypeName in the ObjectDataSource to the MapInfo object but because the Select method only returns the IList I don't have access to the TotalAvailable.
[DataObject(true)]
public sealed class MapInfo
{
private IList<Visit> visits;
private int totalCount;
public IList<Visit> Visits
{
get
{
if (visits == null)
visits = new List<Visit>();
return visits;
}
set
{
visits = value;
}
}
[DataObjectMethod(DataObjectMethodType.Select)]
public IList<Visit> GetAccountVisits(DateTime startdate, DateTime enddate, string orgids, int reportlevel,
string username, int authlevel, bool visited, bool notvisited, string accounttypeid)
{
}
Is there any way to access this value. I know it is being populated in the MapInfo object but all that gets returned from the Select method is the IList
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该数据源在选择发生后触发 Selected 事件;您可以尝试查看它是否公开了根对象。
HTH。
that datasource fires a Selected event after the select happens; you could try to see if it exposes the root object there.
HTH.
我已将 SelectMethod 的返回类型更改为:
在 CreateChildControls 方法中的 CompositeDataBoundControl 中,然后我使用:
不过,我会欣赏更优雅的解决方案。
I have changed the return type of the SelectMethod to:
In my CompositeDataBoundControl in the CreateChildControls method, I then use:
Would appreciate a more elegant solution though.