Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with data binding
Message
From
23/01/2009 21:00:55
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01375705
Message ID:
01376681
Views:
15
>>>>Hi Linda,
>>>>
>>>>>I have a form in which the controls are bound to an alternate table in the biz object. For example, the biz object is OfficeNote and the table is AssignmentNote. I have a text box which has a BindingSource of "OfficeNote" and a BindingSourceMember of AssignmentNote.CompletedBy. When the user clicks on the button to "Complete" the note, I have a line of code in the click method as follows:
>>>>>
>>>>>     this.txtCompletedBy.Text = mmAppDesktop.UserMgr.UserID;
>>>>>
>>>>>
>>>>>When I save the row, the CompletedBy column is not filled in.
>>>>>
>>>>>I ended up changing this to get a reference to the DataRow and assigning the value to the datarow column but I don't understand why assigning the value to the control's text property didn't work? Did I miss something?
>>>>>
>>>>>Thanks.
>>>>
>>>>I am not sure I understand. If the business object for CompletedBy is AssignmentNote, why is the BindingSource set to OfficeNote? What is the relation between this field and the OfficeNote business object?
>>>>Tim
>>>
>>>The business object is OfficeNote but I have a table defined within OfficeNote, a subset of OfficeNote, if you will, which has the name AssignmentNote (all office notes with a note type of 'AN'). I don't really see why the binding should be an issue. When data is typed directly into the other text boxes on the page which have the same type of binding, the values are saved with no problem. It is only when I have a value stored to the Text property of the mmTextBox control through code that I have a problem.
>>>Linda
>>
>>Ah, I see that now in your post. You are setting the text of this textbox but it is bound to the data. Can the user type the value in directly and save it for this field? When you set that value programatically is it showing up in the textbox? I didn't realize that mmAppDesktp.UserMgr.UserID was actually a text value but you didn't mention getting an error on that line. I would have thought a .ToString() would have been needed, but..
>>It sounds like you do have other textboxes bound to this table within the business object with no problem. I would maybe attempt to programatically set one of the other ones that work OK to verify it is not an issue with this specific field. I suppose you could set the value in the entity or datarow rather than setting it to the textbox, but like you I don't see why that should cause an issue. Maybe in the process of making sure that is what is causing the problem you will uncover something else. Sorry I can't be more help.
>>Tim
>
>Thanks, Tim. I'll try setting the text property for a different column and see if that makes a difference. I've been using the mmAppDesktp.UserMgr.UserID to set default values for quite a while and never had to use a .ToString() so I assume that wouldn't be required here either.
>In a twisted sort of way, it still makes me feel better to get a response from someone else saying that they can't figure out why something's a problem because it at least means that now when I stumble it's not on the "easy" stuff. Thanks, as always.
>By the way, I was up near your stomping grounds a few weeks ago, near Jasper, Texas. I didn't realize it until I got home or I would have tried to meet you for lunch or something. That's very pretty country.

I would be very happy to meet you for lunch if ever in the area; don't hesitate to call. Also, I know what you mean about the response thing. If you don't figure this out, let me know and I will try some things here myself and I am sure together we can make sense of it.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform