Reputation: 1
Is it possible to use two separate RadAjaxPanel controls side-by-side on the same page?
I am using two separate RadAjaxPanels in the same page. One panel contains a TextBox and a Button. The other contains a RadGrid control. When I click on the button in panel #1 the 2nd panel disappears. I put visible=True in the button-click event.
ASPX page
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" Height="200px" Width="300px">
<table><tr><td><asp:Label ID="Label1" runat="server" Text="Name"></asp:Label> </td>
<td><%--<telerik:RadTextBox ID="RadTextBox1" runat="server">
</telerik:RadTextBox>--%><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td></tr>
<tr>
<td>
</td>
<td>
<telerik:RadButton ID="RdbtnAdd" runat="server" Text="Submit" CausesValidation="true"
ValidationGroup="AddButtonValidate" OnClick="RdbtnAdd_Click"
Width="75px">
</telerik:RadButton>
</td>
</tr>
</table>
</telerik:RadAjaxPanel>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel2" Height="200px" Width="300px">
<table><tr><td><asp:Label ID="Label2" runat="server" Text="Name"></asp:Label> </td>
<td><%--<telerik:RadTextBox ID="RadTextBox2" runat="server">
</telerik:RadTextBox>--%><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</table>
</telerik:RadAjaxPanel>
</div>
Code Behind:
protected void RdbtnAdd_Click(object sender, EventArgs e)
{
Session["name"] = TextBox1.Text;
//RadAjaxPanel2.Visible = true;
TextBox2.Text = Session["name"].ToString();
}
Upvotes: 0
Views: 10752
Reputation: 450
You could try adding an ajax manager to your page. This would force the ajax postbacks when you click the button.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RdbtnAdd">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel2" LoadingPanelID="RadAjaxLoadingPanel2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
Or you could try just forcing a ajax postback on the second panel when you click your button. So in your button clicked event add...
ScriptManager.RegisterStartupScript(Page, this.GetType, "updatePanel", "$find('" + RadAjaxPanel2.ClientID + "').ajaxRequestWithTarget('" + RadAjaxPanel2.UniqueID + "', '');", true)
Both of these solutions should work. The second would just require the one line in your button clicked event so I'd try it first.
Upvotes: 2
Reputation: 50728
Yes, you can have as many RadAjaxpanel controls as you like. Note, however, RadAjaxPanel functions differently than the UpdatePanel. Only one RadAjaxPanel posts back at a time; however, you can call the client-side API ajaxRequest("arg"); method to refresh the other. I've never had an issue where one panel disappears... we'll probably need to see some code in order to debug.
You can also use the RadAjaxManager (or proxy) to define the AJAX controls that should be updated when one control causes a postback. This way, you can link the updates to all when the button clicks happen.
Upvotes: 0