[CLOSED] How to Add Controls in a Row dynamicaly on PageLoad?

  1. #1

    [CLOSED] How to Add Controls in a Row dynamicaly on PageLoad?

    Hi,
    I want to add controls on a panel dynamicaly on Page_Load.
    Now it's working but them appears in a single column and i want them on a single row.

    Here it's the current code


    
                foreach (MediaTypeInfo mediaType in GetMediaTypes())
                {
                    Coolite.Ext.Web.Button btn = new Coolite.Ext.Web.Button()
                    { 
                        ID = "btnMediaType_"+ mediaType.Id,
                        Icon= mediaType.Icon
                    };
                    btn.ToolTips.Add(new ToolTip(){ Title=mediaType.Value });
                    btn.AjaxEvents.Click.Event += BtnMediaTypeClickedHandler;
                    this.MediaTypes.BodyControls.Add(btn);                
                }
    this.MediaTypes is a Panel


    Thanks
  2. #2

    RE: [CLOSED] How to Add Controls in a Row dynamicaly on PageLoad?

    Hi,

    Just add buttons to table
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
        
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                TableRow row = new TableRow();
                Table1.Rows.Add(row);
    
                for (int i = 0; i < 3;i++ )
                {
                    TableCell cell = new TableCell();
                    row.Cells.Add(cell);
                    Coolite.Ext.Web.Button btn = new Coolite.Ext.Web.Button();
                    btn.Text = "Button";
                    btn.Icon = Icon.Note;
                    btn.ToolTips.Add(new ToolTip() { Title = "title" });
                    cell.Controls.Add(btn);
                }
                
            }
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <asp:Table ID="Table1" runat="server">
            </asp:Table>
           
        </form>
    </body>
    </html>
  3. #3

    RE: [CLOSED] How to Add Controls in a Row dynamicaly on PageLoad?

    *Thanks!

Similar Threads

  1. Replies: 3
    Last Post: Jul 20, 2012, 4:50 PM
  2. Dynamicaly build css rules
    By fabiomarcos in forum 1.x Help
    Replies: 6
    Last Post: May 26, 2009, 5:00 PM
  3. Select Row outside PageLoad
    By wildspirit in forum 1.x Help
    Replies: 2
    Last Post: Mar 21, 2009, 9:55 AM
  4. Desktop: Create new window dynamicaly
    By Nime in forum 1.x Help
    Replies: 17
    Last Post: Jan 28, 2009, 5:06 PM
  5. [CLOSED] Dynamicaly resize west pane with JS
    By testix in forum 1.x Help
    Replies: 2
    Last Post: Nov 24, 2008, 6:03 PM

Posting Permissions