Last post Apr 08, 2005 06:19 PM by richaux
Apr 07, 2005 07:26 PM|rich50|LINK
This may be fairly elementary but perhaps you can answer anyway -
I want to extend the application with some user forms. I have two modules, each with a form, in the contentpane. I want a button on one form to copy the value of one asp:TextBox field to a asp:TextBox field on the other form.
Is it possible? Can you give me a pointer to a doc that might explain the control hierarchy so I can have the button Click event effect another control in another module under DefaultDesktop?
Apr 08, 2005 06:19 PM|richaux|LINK
Hi, I can't run the portal code at present, so the following is unproven but will hopefully give you some pointers...
In general, you can raise an event from one control to the parent form, which then calls a method on the second control to set the text box, for example. [This avoids coupling the two controls together, so they remain independent.]
In the portal, you can specify an event in one user control and have, say, a button click (or whatever) on that control raise the event, e.g.
public event EventHandler evtHappened;
private void Button1_Click(object sender, System.EventArgs e)
evtHappened(this, new EventArgs());
Then, in general, in your parent Form, you can add the event handler and code this to affect the properties of the second control, e.g.
private void Wuc1_evtClicked(object sender, EventArgs e)
MyReceivingControl.myProperty="a click happened";
This is more complicated with DesktopDefault because it does not have fixed instances of the controls (like MySendingControl) but loads them dynamically based on the config file. So you'd need to check the type of the control prior to it being added to the
parent Controls collection to register the eventhandler, e.g. in DesktopDefault's Page_Init
if (portalModule is MyModuleClass)
Another complication is then how to reference the receiving control via DesktopDefault; again, there is no fixed instance to reference, so you need to use a FindControl variation.
private void evtHappened_handler(object sender, EventArgs e)
Hope this isn't complete gibberish.[:)]