HighTechTalks DotNet Forums  

data binding control

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss data binding control in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Pieter Breed
 
Posts: n/a

Default data binding control - 09-19-2005 , 06:14 AM






Hi

I am in the process of developing an extension to a 3rd party grid
control. I now have to implement data binding for the control. It only
needs to bind to a DataTable, but I've got the following problems.

(I think "databind" is the wrong term here. I only plan on editing a
System.Data.DataTable with this grid and nothing else. So "databound"
here means can edit a datatable effectively)

Up till now I've used row indices to keep track of what row I am
working with. however the DataTable.RowChanged event gives you the
actual DataRow that was changed and not the index into the DataTable.
My real problem is that I don't know how to generically associate the
DataRow with the index.

I thought of using the GetHashCode() function in a hidden column, but
this will not work for new rows. If you add a new row to the datatable
it will generate a new identity column value for you( eg. -1, -2, -3
etc...). When you then Synchronize with the db, that row (and other
added rows) should be thrown away, since you get brand new rows back
from the syncing process. This is for the benefit of computed columns,
eg identity columns (as i understand it at least).

Since I control edits to the table on the control side, i now need a
way to intercept the external changes to the datatable, ie those that
occur because of other controls editing it, business rules, syncing
with the db etc.

Thanks,
Pieter Breed


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.