using radajaxmanager I want to have a submit button as an updated control during ajax postback of another button. However when i add the submit button as an update control, it ajaxifys and will no longer postback.
The reason why i need to submit button as an updated control for another controls postback is because i want to conditionally add confirm attribute to the submit depending on settings of other controls on the form. Any help appreciated. A test program is included below
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server"
OutputCompression="AutoDetect">
</telerik:RadScriptManager>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button"
UseSubmitBehavior="False" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<br />
<asp:Button ID="Button2" runat="server" Text="Form Submit" />
<br />
<br />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Button1"
LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="Label1" />
<telerik:AjaxUpdatedControl ControlID="Button2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"
height="75px" width="75px">
<img alt="Loading..."
src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
style="border:0px;" />
</telerik:RadAjaxLoadingPanel>
</div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["bool"] = false;
}
Button2.Attributes.Clear();
}
public bool BoolVal
{
get
{
return (bool)Session["bool"];
}
set
{
Session["bool"] = value;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
BoolVal = !BoolVal;
if (BoolVal)
{
Label1.Text = "Enabled";
Button2.Attributes.Add("onclick", "return confirm('button enabled. sure you want to continue?')");
}
else
Label1.Text = "Disabled";
}
The reason why i need to submit button as an updated control for another controls postback is because i want to conditionally add confirm attribute to the submit depending on settings of other controls on the form. Any help appreciated. A test program is included below
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server"
OutputCompression="AutoDetect">
</telerik:RadScriptManager>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button"
UseSubmitBehavior="False" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<br />
<asp:Button ID="Button2" runat="server" Text="Form Submit" />
<br />
<br />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Button1"
LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="Label1" />
<telerik:AjaxUpdatedControl ControlID="Button2" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"
height="75px" width="75px">
<img alt="Loading..."
src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
style="border:0px;" />
</telerik:RadAjaxLoadingPanel>
</div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["bool"] = false;
}
Button2.Attributes.Clear();
}
public bool BoolVal
{
get
{
return (bool)Session["bool"];
}
set
{
Session["bool"] = value;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
BoolVal = !BoolVal;
if (BoolVal)
{
Label1.Text = "Enabled";
Button2.Attributes.Add("onclick", "return confirm('button enabled. sure you want to continue?')");
}
else
Label1.Text = "Disabled";
}