DirectEventArgs - Dynamic Grid Not Rendering to Placeholder... Help Please!?!?

  1. #1

    DirectEventArgs - Dynamic Grid Not Rendering to Placeholder... Help Please!?!?

    I have a panel - with a placeholder - what I am trying to do - is to dynamically create a gridpanel - based upon selected rows of another - the data executes below fine and the store does load/bind - but nothing renders on the page??!??


            protected void Button3_Click(object sender, DirectEventArgs e)
            {
                string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["EDI"].ConnectionString;
                RowSelectionModel sm = this.GridPanel3.SelectionModel.Primary as RowSelectionModel;
                foreach (SelectedRow row in sm.SelectedRows)
                {
                    string id = row.RecordID.ToString();
                    string clpID = e.ExtraParams["ClpID"].ToString();
                    Ext.Net.GridPanel gp = new Ext.Net.GridPanel { 
                        ID = "GridPanel" + row.RowIndex.ToString(), 
                        TrackMouseOver = true, 
                        Title = ""
                    }; 
                    gp.Store.Add(storeDetails);
                    Ext.Net.Column clmn = new Ext.Net.Column { ColumnID = "ServiceDate", DataIndex = "ServiceDate", Header = "Service Date" }; 
                    gp.ColumnModel.Columns.Add(clmn);
    
                    DataTable dt = new DataTable();
                    SqlParameter[] aryParams = new SqlParameter[2];
                    aryParams[0] = new SqlParameter("@bprID", SqlDbType.Int);
                    aryParams[0].Value = Convert.ToInt32(582);
                    aryParams[1] = new SqlParameter("@clpID", SqlDbType.Int);
                    aryParams[1].Value = Convert.ToInt32(clpID);
                    dt.Load(SqlHelper.ExecuteReader(connStr, CommandType.StoredProcedure, "sp835_ClaimDetailsGET", aryParams));
                    storeDetails.DataSource = dt;
                    storeDetails.DataBind();
                    ph1.Controls.Add(gp);
                    ph1.Update();
                    Panel6.Render();
                }
                //this.ResourceManager1.AddScript("alert('" + clpID + "');");
            }
  2. #2
    Hi,

    Do you really need a PlaceHolder control?

    What about to add a GridPanel directly to the Panel?

    Panel6.Items.Add(gp);
    gp.Render();
  3. #3
    That works... Wasted a ton of time trying to get a repeater to update and now back to dynamically updating controls... Thanks!!
  4. #4
    Thanks again
  5. #5
    By the way, it works with a PlaceHolder as well.

    But a GridPanel will be out of layout logic. So, I still suggest to use the first option to place a GridPanel directly to Panel Items.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void RenderGridPanel(object sender, DirectEventArgs e)
        {
            GridPanel grid = new GridPanel()
            {
                Title = "GridPanel",
                Width = 200,
                Height = 200,
                Store =
                {
                    new Store()
                }
            };
    
            this.PlaceHolder1.Controls.Add(grid);
    
            this.Panel1.Render();
        }
    </script>
    
    <!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 runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Container 
                runat="server" 
                Width="200" 
                Height="200" 
                Layout="FitLayout">
                <Items>
                    <ext:Panel ID="Panel1" runat="server">
                        <Content>
                            <asp:PlaceHolder ID="PlaceHolder1" runat="server" />
                        </Content>
                    </ext:Panel>
                </Items>
            </ext:Container>
            <ext:Button runat="server" Text="Render GridPanel" OnDirectClick="RenderGridPanel" />
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Dynamic adding and rendering
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 17, 2012, 12:23 PM
  2. [CLOSED] Question about dynamic rendering subclassed controls
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 26, 2012, 9:55 AM
  3. Replies: 2
    Last Post: Oct 18, 2011, 3:50 PM
  4. [CLOSED] Dynamic controls are not rendering correctly
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 16, 2011, 9:05 PM
  5. [CLOSED] Odd rendering problems with a dynamic context menu
    By mattwoberts in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 11, 2011, 10:36 AM

Posting Permissions