Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design assistance
Message
 
To
05/12/2005 12:26:15
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01074006
Message ID:
01074998
Views:
28
Let me try to explain again (might be different from both 1st and 2nd post <s>).

I place my custom user control on the form and and "wire" up the ControlChanged event to the form's SaveChange() method. The SaveChange() method will connect to a datastore and try to update some field, if no exceptions aree caught everything is great, but if an exception is caught the SaveChanges() method somehow needs to convey that information to the user control so that the usercontrol can be updated.

One idea is simply to refresh the usercontrol (will will re-read the datatables and display the information all over again). Another idea is to add a public method to the user control that accepts an identifier and the "correct" value then the method searches for the control's identifier and updates the value.

I might be over-thinking this relatively simple scenario.

Einar

>Still not sure what does what here ... what you've described in your first post seems different than what you've described in your second post.
>
>~~Bonnie
>
>
>>>>I am not sure if I am approaching this the wrong way or if I am just making things a lot more difficult.
>>>>
>>>>Here is the scenario. I have a custom user control on my form. The user control raises an event, the form executes the method specified. the method makes a connection to a database and tries to update a row in a table. Now lets assume something went wrong (yes it might happen) and the record could not be updated. What is the reccomended (best practive) to convey that information back to the usercontrol?
>>>
>>>The best-practice method for "black-box" controls is to catch the error within the control, clean up any connections, readers, etc., and then throw a new exception. The new exception should be a custom type that is defined within the library that contains the control.
>>
>>I am not attempting to create a "black-box" control. The control is passed 3 datatables (through properties) used to display information to the user (it is a complex treeview control). I don't want the control to know anything about where the datatables came from. Now the user changes the Title of one of the tree nodes (same way as you would rename a folder in the explorer's treeview control). I don't want the control to connect to my datastore to update the name.
>>
>>Bottom line is that I want to keep data access separate from the custom control.
>>
>>Einar
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform