Click here to Skip to main content
15,891,424 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
Hi,
i need to change javascript alert to ajax modal popup alert.

how to convert alert message code to AjaxModalPopup code

In this line written in c#.same as javascript inside ajax popup open.


XML
protected void Page_Load(object sender, EventArgs e)
{
   if (Request["CalledFrom"].ToString() != "ATL")
   {
   string js = null;
   js = "<script language='javascript'>alert('Following Courses have been approved    for    your Admin')</script>";
    Page.RegisterStartupScript("js", js);
   }
}
Posted
Updated 5-May-14 23:22pm
v3
Comments
Manas Bhardwaj 6-May-14 4:48am    
Any effort?
pkarthionline 6-May-14 4:54am    
how to write the code without use ajaxtoolkit?
pkarthionline 6-May-14 9:28am    
ClientScript.RegisterClientScriptBlock(this.GetType(), "MessagePopUp", "alert('Module value approve to Admin');", true);

or

string js = null;
js = "<script language='javascript'>alert('Following Courses have been approved for your Admin')</script>";
Page.RegisterStartupScript("js", js);

this is correct way.

Quote:
how to write the code without use ajaxtoolkit?
Simply, not possible.

You have to use that in order to implement Ajax ModalPopupExtender[^].
 
Share this answer
 
Comments
pkarthionline 7-May-14 9:11am    
c#:
ClientScript.RegisterClientScriptBlock(this.GetType(), "MessagePopUp", "courseApprove();", true);

javascript:
<script>
function courseApprove() {
debugger;
$("#dialog-message").dialog({
modal: true,
buttons: {
Ok: function () {
$(this).dialog("close");
}
}
});
</script>

asp.net:
<div id="dialog-message" title="Message">
<p>
<span style="float:left; margin:0 7px 50px 0;"></span>
Your files have downloaded successfully into the My Downloads folder.
</p>

</div>

can we use this?
Yeah, why not?
pkarthionline 8-May-14 1:37am    
i am got error above the code
What is that error?
pkarthionline 8-May-14 5:04am    
i am got small error.i am solved error.but i need client side code.below the code was in server side code.

Where i will change to it?

thanks.
Hi,
In this code server side. code is working good.
how to change in this code to client side code.

How to check below C# code to check in Jquery validation condition?
c#: code

C#
if (dstcourse.Tables[0].Rows.Count == 0)
 {
  ScriptManager.RegisterStartupScript(this, this.GetType(), "scr", "$('#dialog').dialog({model:true, zIndex:20000});", true);
  }
 else if (dstModuleLevelInfo.Tables[0].Rows[0][0].ToString() == "-1" )
 {
   ScriptManager.RegisterStartupScript(this, this.GetType(), "scr", "$('#dialog2').dialog({model:true, zIndex:20000});", true);
 }


jquery:

XML
<script type="text/javascript" language="javascript" src="http://code.jquery.com/resource/jquery.js"></script>
<script type="text/javascript" language="javascript" src="http://code.jquery.com/resource/model-popup.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />


XML
<script language="javascript">
        
        $(document).ready(function () {
            $(function () {
                $("#dialog").dialog({

                    autoOpen: false,
                    modal: true,
                    show: {
                        effect: "blind",
                        duration: 1000
                    },
                    hide: {
                        effect: "explode",
                        duration: 1000
                    },
              buttons: { "Ok": function() { $(this).dialog("close"); } } 
                });
                $("#dialog2").dialog({

                    autoOpen: false,
                    modal: true,
                    show: {
                        effect: "blind",
                        duration: 1000
                    },
                    hide: {
                        effect: "explode",
                        duration: 1000
                    },
             buttons: { "Ok": function() { $(this).dialog("close"); } } 
                });
            });
        });
        </script>


-------------------------------------------------------------------------
asp.net:
--------
XML
<div id="dialog" title="Message">
       <p>
           <span style="float: left; margin: 0 7px 50px 0;"></span> Module value approve to Admin
       </p>
   </div>
       <div id="dialog2" title="Message">
       <p>
           <span style="float: left; margin: 0 7px 50px 0;"></span> Module Level value approve to Admin
       </p>
   </div>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900