I'm trying to add one test control on the server side to my WebDialogWindow and am having no luck. I'm handling the "showing" of the modal on a Row Command event from a grid view. Here are the relavent bits:
{BUTTON on Grid}
<asp:ImageButton ID="GridBtn" runat="server" CommandArgument='<%#Eval("MajorBrainstormID") %>' CommandName="display" ImageUrl="~/img/blankgrid.png" />
{CODE}
Public Sub BrainstormGrid_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles PriorityGrid.RowCommand If (e.CommandName = "display") Then Dim btn As New Label btn.Text = "test" Dim dialog As WebDialogWindow = TryCast(PriorityGridModal, WebDialogWindow) With dialog .ContentPane.Controls.Add(btn) .WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal End With gridUpdatePanel.Update() End If End Sub
{CONTROL on .aspx page}
<asp:UpdatePanel runat="server" ID="gridUpdatePanel" UpdateMode="Conditional"> <ContentTemplate> <ig:WebDialogWindow ID="PriorityGridModal" runat="server" Height="300px" Width="400px" Modal="True" Moveable="true" Top="0px" Left="0px" WindowState="Hidden" CssClass="modalContainer" > <ContentPane> <Template> </Template> </ContentPane> </ig:WebDialogWindow> </ContentTemplate> </asp:UpdatePanel>
The DialogWindow displays just fine, but it is empty. Can't seem to work out why. I'm not getting any errors, and I've stepped through the execution and everything is firing as expected. What am I missing?
Hmmm....well, it doesn't really work.
I stripped away the nonsense, and left us with just a simple working modal:
{.aspx page}
<asp:Button Text="Show Modal" runat="server" ID="showBtn" OnClick="showModal" />
<ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px" Width="400px"Modal="true"Moveable="true"WindowState="Hidden"ModalBackgroundCssClass="modalBackground"> <ContentPane> <Template></Template> </ContentPane></ig:WebDialogWindow>
{.aspx.vb code}
Dim lbl As New Label lbl.Text = "Hi there" WebDialogWindow1.ContentPane.TemplateControl.Controls.Add(lbl) WebDialogWindow1.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.NormalEnd Sub
So, the code "works" in that a label is added...but it is added to my page, not the modal (appears outside the modal on the page behind. Do I have to create a "named" template or something?
Hello,
Thanks for the detailed description of the problem. I believe the solution here is to add controls to the TemplateControl object of the ContentPane, as opposed to the ContentPane directly. I have just tried this and it works great:
Label l = new Label(); l.Text = "GGGGGG"; WebDialogWindow1.ContentPane.TemplateControl.Controls.Add(l);
Please, let me know if this helps.