|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
Is is possible to use a Dialog as a user control? I have not seen any postings here or examples. If it is possible, can you show some examples? Dialog will contain some textboxes, two MaskedEdit extenders and a a DropDownList which will be populated from a c# class method on page load.
Thanks.
|
|
Rank: Member Groups: Member
Joined: 11/16/2007 Posts: 18
|
Yes you can... I have not got any problems with the controls you mentioned so far... They actually look really cool when you use them as a user control...
My only concern will be how to reference the controls from my code behind since they belong to a Dialog container!! you may want to ask that.
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
That is a logical next question... I have not been able to get the dialog to pop up. Hence the question.. So far I seem to be at a loss on this.
I have the dialog already working with the controls as stated, but not as a user control. Now we are using the same functionality on several pages, so it makes sense to keep it all in one place. Do you have a quick expample using the dialog as a user control?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
I believe one way is to add some public properties on your user control and then access those controls through those properties. You may need to cast the UserControl into your specific user control class type before you can use it in this way.
Another way is to use FindControl to find those controls and then cast the return value to their specific types.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
Hi,
Thanks for the follow-up. I am just getting back to this now...
I have the dialog working (partiallly) and I am able to access the public properties on the control from the host page. In it's original (pre-user control) configuration, I was validating the dialog form data and setting the error text and setting the "Dialog.InitialState = EO.Web.DialogState.Visible;" to allow the user to correct any errant data. This was easy to do when the form was embedded in the page, but now, the Dialog.InitalState property of the dialog is not available from the user control now since the control is a child object of the dialog as shown below (some parameters removed for clarity):
<eo:Dialog ID="Dialog_NewList" runat="server" Height="350px" Width="480px" HeaderHtml="Create New List"> <ContentTemplate> <uc1:NewListForm ID="NewListForm" runat="server"> </uc1:NewListForm> </ContentTemplate> </eo:Dialog>
Code in the control submit button handler (ascx.cs) ..
protected void CreateList_Click(object sender, EventArgs e) { ... if (!formValid) { lblNewListError.Text = errMsg; lblNewListError.Visible = true; //Dialog_NewList.InitialState = EO.Web.DialogState.Visible; // this fails... this.PageIsValid = false; } else { // execute the class method to add new list. } }
Somehow... I need to be able to pass back, to the host page, or read, a flag that tells the page to keep the dialog open when form validation has failed. Is my method here correct? Or am I going about this wrong?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, We won't really be able to provide support on this. You would run into the same situation even if you use a standard ASP.NET control. So we view this as a generic ASP.NET programming issue, rather than a question related to our product. You may wish to review our support policy here: http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=1368Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
Ok, thanks.
|
|