I have a button similar to this example:-
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxPanel ID="mainAjaxPanelContentManager" runat="server" Height="100%" LoadingPanelID="contentManagerRadAjaxLoadingPanel" OnAjaxRequest="ContentManagerAjaxRequest"></telerik:RadAjaxPanel>
<asp:ImageButton ID="btnadd" runat="server" ImageUrl="~/Images/Done.png"
Height="20px" OnClientClick="test()"/>
then I have a JavaScript function as shown below:-
function test()
{
var result;
var r = confirm("Duplicate Serial Number - Do you want to change it?");
$find("<%= mainAjaxPanelContentManager.ClientID %>").ajaxRequest(r);
}
This function successfully triggers the following server-side method:-
protected void ContentManagerAjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
if (e.Argument.ToLower() == "true")
{
}
}
However, when I attempt something like this:-
<asp:ImageButton ID="btnadd" runat="server" ImageUrl="~/Images/Done.png"
Height="20px" OnClick="btnadd_Click"/>
protected void btnadd_Click(object sender, ImageClickEventArgs e)
{
showMessageBox("Hello");
}
protected void showMessageBox(string message)
{
string sScript = "";
sScript += "var result;";
sScript += "var r = confirm('Duplicate Serial Number - Do you want to change it');";
sScript += mainAjaxPanelContentManager + ".ajaxRequest(r);";
ScriptManager.RegisterStartupScript(this, this.GetType(), "confirm", sScript, true);
}
The server-side method ContentManagerAjaxRequest
is not executed and an exception is thrown stating "Object doesn't support this property or method".
It seems that ajaxRequest()
is not supported on the server-side. What would be the alternative solution in this case?
My issue revolves around displaying a confirmation message from the server-side and then triggering a specific server-side method such as "ContentManagerAjaxRequest
" based on the user's response.