When using a databound control the Bind() method does some magic to first extract the current value from the datasource and then pass an update back to the datasouce when an update is performed.
Now I have created a custom datasource and am supplying my own custom data which all works fine. For read only the following code works a treat. As you can see I am accessing both a named index into the collection and a property.
Now when using Bind() I cannot find a way to accomplish this. Bind() would appear to look for either an object property or a database row column (not sure how it does this) and I cannot find a way to change this.
It shouldn't be that difficult because the hard part is obtaining the data, which my code below can already do. The changes are passed back as a dictionary which should be simple. But I need a way to write my own bind method and I haven't managed to find out how.
Surname : <asp:TextBox ID="TextBox2" Text='<%#((MyCustomDataRow)Container.DataItem)["Surname"].EditDataString%>' runat="server" />