|
Rank: Member Groups: Member
Joined: 6/20/2007 Posts: 17
|
I have a form in my application that displays list of people in Repeater. One of the columns contains 'Edit' LinkButton that should bring up a dialog with edit controls (text boxes, option buttons, check boxes, etc.) populated with the selected user's data. I have following questions about this:
1) How to pre-populate controls with selected person's information? Most likely there will be database request executed to grab person's information, so it's desireble to use Callback if it's possible to avoid postback.
2) Is it possible to place Validator controls on dialog and validate them on dialog submit? Or I must write my own validation scripts?
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Sana,
Both are possible. While visually the dialog is a separate layer on your page, it is actually an element inside your page. So you should be able to use whatever ways that used to work with elements inside your page on the dialog. The only thing that's special about the dialog is that the dialog is a container. So in order to get a reference of the controls inside the dialog, you would need to use dialog1.ContentContainer.FindControl.
I believe in both case (displaying the dialog and submitting the dialog) you can use CallbackPanel. Just place a dialog inside the callback panel and set the dialog's InitialState to "Visible" or "Hidden" on the server side should display and close the dialog properly.
Thanks
|
|
Rank: Member Groups: Member
Joined: 6/20/2007 Posts: 17
|
Thanks! After a little bit of experimenting I was able to get it to work. Just posting this snippet of code for anyone else who has the same question, could using this as an example.
Code: HTML/ASPX
<eo:CallbackPanel id="panDialog" runat="server" Triggers="{ControlID:btnShowDialog1;Parameter:1},{ControlID:btnShowDialog2;Parameter:2}">
<asp:LinkButton id="btnShowDialog1" runat="server"></asp:LinkButton>
<asp:LinkButton id="btnShowDialog2" runat="server"></asp:LinkButton>
<a id="ancShowDialog1" href="javascript:eo_Callback('panDialog',3)">Show Dialog 3</a>
<a id="ancShowDialog2" href="javascript:eo_Callback('panDialog',4)">Show Dialog 4</a>
<eo:dialog id="Dialog1" runat="server" BackColor="White"
AcceptButton="btnSave" CancelButton="btnCancel" BorderWidth="1px"
BorderStyle="Solid" ControlSkinID="None" BorderColor="#BDD1EC"
HeaderHtml="Dialog Title" CloseButtonUrl="00020015"
asp:Button id="btnSave" runat="server" Text="Save"></asp:Button>
<asp:Button id="btnCancel" runat="server" Text="Cancel"></asp:Button>
</FooterTemplate>
<HeaderStyleActive CssText="padding-right: 4px; padding-left: 4px;
font-weight: bold; font-size: 11px; padding-bottom: 6px;
color: #b1b1b1; padding-top: 6px; font-family: verdana">
</HeaderStyleActive>
<ContentStyleActive CssText="padding-right: 4px; border-top: #bdd1ec 1px solid;
padding-left: 4px; font-size: 11px; padding-bottom: 4px; padding-top: 4px;
font-family: verdana">
</ContentStyleActive>
<ContentTemplate>
<asp:Label id="lblText" runat="server">Label</asp:Label>
</ContentTemplate>
</eo:dialog>
</eo:CallbackPanel>
With server side code handling Execute event of the Callback panel:
Code: C#
private void panDialog_Execute(object sender, EO.Web.CallbackEventArgs e)
{
Label lblText = (Label)Dialog1.FindControl("lblText");
lblText.Text = e.Parameter;
Dialog1.InitialState = EO.Web.DialogState.Visible;
}
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Sana, thanks for sharing!
|
|