This is a migrated thread and some comments may be shown as answers.

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

1 Answer 95 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 1
Brett asked on 16 Nov 2012, 08:19 PM
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();
 }

1 Answer, 1 is accepted

Sort by
0
Brett
Top achievements
Rank 1
answered on 19 Nov 2012, 12:18 AM
I fixed the issue. I need to call .Databind() on the panel to have the controls show up.
Tags
Ajax
Asked by
Brett
Top achievements
Rank 1
Answers by
Brett
Top achievements
Rank 1
Share this question
or