locked
Auto-bindable custom data source? RRS feed

  • Question

  • User1845109346 posted

    Hi,

    I have created a custom datasource that works just great when binded to a control. However, I'd like to be able to use it, in some case, by itself, without binding it to a bindable control.

    myDataSource.Rows should return a collection of rows but it only works when I have previoustly created a bindable control like a gridView, that I have associated its datasource to my custom datasource and that I have called DataBind() method of this gridview control.

    Do you guys know how I can directly implement a databind method to my datasource. Is it even possible?

    Thanks a bunch

    Tuesday, August 21, 2012 10:39 PM

Answers

  • User-1828494216 posted

    If you only need to return an array or list of objects then you can simply create a read only public property as you would for any other parameter. In the get method get that list from your cache/query db/...

    You can also take a look at my old post.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 22, 2012 7:55 PM

All replies

  • User-1828494216 posted

    If you only need to return an array or list of objects then you can simply create a read only public property as you would for any other parameter. In the get method get that list from your cache/query db/...

    You can also take a look at my old post.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 22, 2012 7:55 PM
  • User3866881 posted

    Do you guys know how I can directly implement a databind method to my datasource. Is it even possible?

    As far as I see, this function isn't easy to be implemented……and you have to use something like reflector to reflect the codes there or you can directly inherit from the GridView to override the DataBind() function by adding something to implement your own task……

    Reguards!

    Thursday, August 23, 2012 9:13 PM