Ask a Question related to ASP.NET General, Design and Development.
-
sunil #1
loadcontrol
Will the state of a dynamically loaded control preserved in transitions
between aspx pages hosting the control.?
thanks
sunil Guest
-
LoadControl and Validation Summary
I am working on a project that dynamically loads controls from within Page_init so that the viewstate is preserved. On post back the control saves... -
LoadControl and CType error
Hey. I'm trying to dynamically add User Controls to my page. It appears to work sometimes, but more often I get the error: Unable to cast object of... -
LoadControl performance
How is LoadControl's performance compared to adding a control directly on the WebForm designer? TWH -
When does LoadControl really load the control?
Hi, I'm loading a user control (.ascx) with LoadControl in a code-behind page. LoadControl returns successfully, and the valid reference it... -
Need help with LoadControl
When I try to use LoadControl I get the error message below. Any help would be great. Kurt Control '_ctl0_Classification' of type 'TextBox'... -
sunil #2
Re: loadcontrol
HrtgSkr, here is the situation. All web pages have header and footers which
are user controls. Iam loading
these controls in base class of my page using LoadControl. Will the state of
these dynamically loaded control
preserved between transitions in pages. For e.g Will the tree control in the
header preserver its state when i
navigate to a different web-pages?
I hope iam clear now.
Appreciate your response.
thanks
"HrtgSkr" <vb.frizzb2@verizon.net> wrote in message
news:ec48160d.0308112001.709b5d0@posting.google.co m...> You want the parent page to access property values in the usercontrol?
>
> Create public properties in your control, then access them through the
> usercontrol on the parent page.
>
> public string ControlName
> {
> get { return mstrName;}
> set { mstrName = value;}
> }
>
> protected MyControlClass myControl;
>
> string someName = myControl.ControlName;
>
> I have found it easier to place the usercontrol on the page, and then
> toggle it's visible property depending on the situation.
>
> You probably need to create some events to allow the child to notify
> the parent that a value has changed, and the parent to tell the child
> to do its' job with that value.
>
> If the parent wants to tell the usercontrol to clear it's properties:
>
> public event EventHandler ClearEvent;
>
> protected virtual void OnClearEvent(EventArgs e)
> {
> if (ClearEvent != null)
> ClearEvent(this, e);
> }
>
> this.ClearEvent += new
> System.EventHandler(this.myControl.OnClearEvent);
>
> In the usercontrol:
>
> public void OnClearEvent(object sender, System.EventArgs e)
> {
> mstrName = "";
> }
>
> Hope that was what you meant.
> :-)
> Dawn.
sunil Guest



Reply With Quote

