[CLOSED] Dynamic form generation in 2.0

  1. #1

    [CLOSED] Dynamic form generation in 2.0

    I used to have a form that was generated server side...worked great until I moved to 2.0. What is the change the get this working again?

    Here is the server-side code:
    [DirectMethod]        public void RecreateForm(object o, DirectEventArgs e)
            {
                string[] date = e.ExtraParams["dateInfo"].Split(new string[] { "-" }, StringSplitOptions.None);
                int portfolioId = Convert.ToInt32(this.hidPortfolioId.Text);
    
    
    
    
                WPDBEntities ent = new WPDBEntities();
                PortfolioCompany co = (from c in ent.PortfolioCompanies
                                       where c.PortfolioCompanyId.Equals(portfolioId)
                                       select c).FirstOrDefault();
                var titles = ent.sp_getFinancialResultGrid(Convert.ToInt32(this.hidPortfolioId.Text), Convert.ToInt32(date[0].Replace("Q", string.Empty)), Convert.ToInt32(date[1]));
    
    
                var form = new FormPanel
                {
                    ID = "FormTaskPanel1",
                   // RenderFormElement = false,
                    Border = false,
                    AutoHeight = true,
                    AutoScroll = true,
                  //  LabelWidth = 150,
                 //   LabelAlign = LabelAlign.Left,
                    Padding = 5
                };
                foreach (var title in titles)
                {
                    if (!title.IsCalc)
                    {
                        NumberField df = new NumberField();
                        df.FieldLabel = title.Title;
                        df.ID = "Control_" + title.PortfolioPerformanceTitleId.ToString();
                        df.Value = (title.Value == null) ? string.Empty : title.Value.ToString();
                        df.LabelStyle = (title.IsCalc) ? "font-style:italic;padding-left:8px" : "";
                        hidControlIds.Text += title.PerformanceDataId.ToString() + ":";
                        df.IDMode = IDMode.Explicit;
                        df.Listeners.Blur.Handler = string.Format("ClientSaveChanges(this.value,{0},{1});", (title.PerformanceDataId != null) ? title.PerformanceDataId.ToString() : "0", title.PortfolioPerformanceTitleId);
                        form.Items.Add(df);
                    }
                }
                this.pnl.Items.Clear();
                form.Render(this.pnl , RenderMode.RenderTo);
             
            }

    And here is the markup:
     <ext:Panel runat="server" ID="pnl" AutoHeight="true">        <TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server">
                    <Items>
                        <ext:Label runat="server" Text="Quarters:" Flat="true"></ext:Label>
                        <ext:ComboBox runat="server" ID="cmboQuarters"> 
                            <DirectEvents>
                                <Select OnEvent="RecreateForm">
                                    <EventMask Msg="Fetching data..." MinDelay="0" ShowMask="true" Target="CustomTarget" CustomTarget="#{pnl}" />
                                    <ExtraParams>
                                        <ext:Parameter Name="dateInfo" Value="this.value" Mode="Raw" />
                                    </ExtraParams> 
                                </Select>
                            </DirectEvents>
                        </ext:ComboBox>
                        <ext:Label ID="lbFYE" runat="server" Text="Fiscal Year End:" Flat="true" StyleSpec="padding-left:5px"></ext:Label>
                    </Items> 
                </ext:Toolbar> 
            </TopBar>
        </ext:Panel>
    Last edited by Daniil; Aug 26, 2012 at 9:47 AM. Reason: [CLOSED]
  2. #2
    Please provide more details about your issue
    What exactly is the problem?
  3. #3
    Quote Originally Posted by Vladimir View Post
    Please provide more details about your issue
    What exactly is the problem?
    Oh...the form isn't showing after the direct event that hits that method.
  4. #4
    You have to use 'RenderMode.AddTo' instead 'RenderMode.RenderTo'
  5. #5
    Quote Originally Posted by Vladimir View Post
    You have to use 'RenderMode.AddTo' instead 'RenderMode.RenderTo'
    That did the trick!

Similar Threads

  1. Replies: 0
    Last Post: Jan 06, 2012, 8:52 AM
  2. [FIXED] [1.2] JS Generation BUG
    By devil in forum Bugs
    Replies: 6
    Last Post: Nov 22, 2011, 10:53 AM
  3. [CLOSED] Dynamic Menu Generation from Comma Delimited String
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 18, 2009, 9:18 AM
  4. [CLOSED] Script generation bug?
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 28, 2009, 4:44 PM

Posting Permissions