开发者

ObjectDataSource databinding: Getting object properties following Select Method call

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开发者_StackOverflow)]
    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


that datasource fires a Selected event after the select happens; you could try to see if it exposes the root object there.

HTH.


I have changed the return type of the SelectMethod to:

[DataObjectMethod(DataObjectMethodType.Select)]
public MapInfo GetAccountVisits(DateTime startdate, DateTime enddate, string orgids, int reportlevel,
     string username, int authlevel, bool visited, bool notvisited, string accounttypeid)
{

In my CompositeDataBoundControl in the CreateChildControls method, I then use:

DataBinder.Eval(((object[])(dataSource))[0], "Visits");

Would appreciate a more elegant solution though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜