I have the following problem, and made a test project out of it.
On my form i have a RadAjaxManager, a clientside button, a serverside button, and a asp:panel.
Configured in the AjaxManager (ajaxsettings):
- buttonServerSide updates buttonServerSide
- asp:panel updates asp:panel
When i press the buttonServerSide, my asp:panel gets updated from the server as well, while i did not configure it like that :(.
Same behaviour when i add above ajaxsettings in the page_load in the .cs file.
Also, is it possible to add ajaxsettings outside the page_load, or is it not meant for that kind of things? This could come in handy with more complex websites with many usercontrols, this way we do not have to configure all ajaxsettings at page_load, but can be configured / added during runtime, which may be easier.
(can retrieve the calling element via the scriptmanager).
Thx in advance!
Below is the aspx code, and the .cs code from my small test project:
/*aspx*/
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="__ajax_test.aspx.cs" Inherits="uitprobeersels__ajax_test" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!
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>Untitled Page</title>
<
script language="javascript" type="text/javascript">
// <!CDATA[
function
ButtonClient_onclick()
{
document.getElementById(
"Panel1").style.backgroundColor = "Red";
alert(
"Background color of Panel1 changed to red");
}
// ]]>
</
script>
</
head>
<
body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<div>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Panel1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Panel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ButtonServerside">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ButtonServerside" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<asp:Panel ID="Panel1" runat="server">This is a panel.</asp:Panel>
<input id="ButtonClientside" type="button" value="Clientside Button" onclick="ButtonClient_onclick()" /></div>
<br /><br /><br />
<asp:Button ID="ButtonServerside" runat="server" OnClick="Button1_Click" Text="ButtonServerside (postback)" />
</form>
</
body>
</
html>
/*cs*/
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
public
partial class uitprobeersels__ajax_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//do nothing here
}
}