Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
804
Adding controls in WebDialogWindows in code behind
posted

Hi,

 

I want to add some controls dynamicaly on server side. I already use ContentPane, PlaceHolder, etc...

But anything work. For beginning I just want to put a label in the ContantPane of the webDialogWindows. When I use the PlaceHolder, the labels are showing in the body of the Web Page, but never in the ContentPane of webDialogWindow.

 for (int i = 1; i < tt_data_webDialogWindow.Columns.Count; i++)
 {
                                base.CreateChildControls();
                                labelData = new Label();
                                labelData.Text =       Convert.ToString(tt_data_webDialogWindow.Rows[wp_indexDataTable][i]);
                                ContentPaneData.Controls.Add(labelData);
                             
}

 

Thanks you for the future help

 

Gabriel Deschênes

Parents
No Data
Reply
  • 28407
    Suggested Answer
    posted

    HI ,

     Here is my code behind to add a label and button to a WDW.

     using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label lb = new Label();
            lb.ID = "lb";
            lb.Text = "label 1";
            WebDialogWindow1.ContentPane.Controls.Add(lb);
            Button bt = new Button();
            bt.ID = "bt";
            bt.Text = "click me";
            bt.Click += new EventHandler(bt_Click);
            WebDialogWindow1.ContentPane.Controls.Add(bt);

        }

        void bt_Click(object sender, EventArgs e)
        {
            Label lb = (Label) WebDialogWindow1.FindControl("lb");
            lb.Text = DateTime.Now.ToLongTimeString();
        }
      
    }

    Here is my aspx page:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <%@ Register assembly="Infragistics2.Web.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.LayoutControls" tagprefix="ig" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
                <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px"
                    Width="400px">
                </ig:WebDialogWindow>
            </div>
        
        </form>
    </body>
    </html>

Children
No Data