0

I want to show confirm dialog from code be hind.

I have a comfirm dialog A. when I click button OK on A, it was call to the method B in code be hind(using ajax post: url/B and B is a method has webmethod attribute).

In method B I want to show other dialog, and code is flowing:(B is AlertInformLogOut )

[WebMethod]
    public static void AlertInformLogOut(string alertId, string option)
    {           
            //TODO: Open call schedule
            var page = HttpContext.Current.Handler as Page;
            // PopUp alert notify info
            if (page != null)
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "script", "AlertSetDialog(" + new JavaScriptSerializer().Serialize(new AlertInformEntity()) + ", 'AlertInforms');", true);
                //ScriptManager.RegisterClientScriptBlock(page, page.GetType(), "script", "AlertSetDialog(" + new JavaScriptSerializer().Serialize(new AlertInformEntity()) + ", 'AlertInforms');", true);
            }

    }

problem is: Dialog not showing.

Can some body tell me why, and can I showing dialog from a method has webmethod attribute.

lmt1608
  • 84
  • 9

1 Answers1

0

The problem is, as I recall, a WebMethod wont update the page, unlike an ASP:update panel call back.

As you are using jQueries ajax function, use the success call back there, instead of trying to do it server side.

$.ajax({ 
   type: "POST", 
   url: url+"/UpdateAlertInfo",....,
   success: /*Call you Confirm Function Here */
 }

You may alss want to consider using $.post() insteado

Jon P
  • 19,442
  • 8
  • 49
  • 72