Dynamically created controls not being added to panel on button click.

2 posts, 0 answers
  1. Brett
    Brett avatar
    12 posts
    Member since:
    Jul 2011

    Posted 16 Nov 2012 Link to this post

    I am using a radtabstrip with a radmultipage. When I click a button on pageview1 I want to dynamically create and add controls to the radAjaxPanel on pageview2. When I run my application I click the button and the controls are not being displayed in the panel at all.

    EDIT- If I move the AjaxPanel Outside of the Multipage PageView it works! But I need to use it inside the pageview.

    Markup (I didnt include everything)
    <telerik:AjaxSetting AjaxControlID="radButtonStep3Next">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radAjaxPanel" />
                    <telerik:AjaxUpdatedControl ControlID="radTabStripAddAssetWizard"  />
                    <telerik:AjaxUpdatedControl ControlID="radMultiPageAddAsset" />
                </UpdatedControls>
    </telerik:AjaxSetting>
    <telerik:RadButton ID="radButtonStep3Next" runat="server"
                    Text="Next" Skin="Sunset" ValidationGroup="validationGroupStep3"
                    onclick="radButtonStep3Next_Click"></telerik:RadButton>
    <telerik:RadAjaxPanel ID="radAjaxPanel" runat="server">
     </telerik:RadAjaxPanel>

    CodeBehind
    private void GenerateCompanyControls()
          {
      
              TextBox txtbx = new TextBox() { ID = "testTextBox" };
              radAjaxPanel.Controls.Add(txtbx);
      
          }
    protected void radButtonStep3Next_Click(object sender, EventArgs e)
     {
         GenerateCompanyControls();
     }
  2. Brett
    Brett avatar
    12 posts
    Member since:
    Jul 2011

    Posted 18 Nov 2012 Link to this post

    I fixed the issue. I need to call .Databind() on the panel to have the controls show up.
Back to Top