Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataBinding revisited
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00716215
Message ID:
00716247
Views:
17
Bonnie,

The Position property must call every get that is used for databinding when the position is changed. This makes some sense though since it wants to update the DataRow before the row is changed and new values are fetched. Is this breaking your code? Doesn't this.m_BindThis have the correct value to replace the DataRow with?

>Cathi,
>
>Yes, I traced it and the get is fired when the Position changes ... this, I assume, is what's changing the underlying DataRow. But why does this happen?
>
>~~Bonnie
>
>
>>Bonnie,
>>
>>Have you tried tracing your code or putting in messages when the get and set are fired off? You are saying that you DataRow is getting changed when you change positions using BindingContext.Position and there has been no change by the user to the custom property?
>>
>>>Has anyone tried data-binding to a property that you've defined? I have the following (this is for a checkbox):
>>>
>>>
>>>protected bool m_BindThis;
>>>
>>>this.DataBindings.Add("BindThis", MyDataTable, "MyColumn");
>>>
>>>[Bindable(true)]
>>>public bool BindThis
>>>{
>>>  get {return this.m_BindThis;}
>>>  set
>>>  {
>>>    this.m_BindThis = value;
>>>    this.Checked = this.m_BindThis;
>>>  }
>>>}
>>>
>>>
>>>There's other things that need to be defined in this check-box subclass (like an Event Handler or two), but my problem isn't there. My problem is that as soon as the BindingContext.Position changes to a different row of the bound table, the value of the bound column gets changed (presumably by the get of the BindThis property). This obviously shouldn't happen, but I'm stumped as to what I might be missing.
>>>
>>>Anyone have any suggestions???
>>>
>>>TIA,
>>>~~Bonnie
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform