Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('error !') ", true);
- lblError.Text = "A database error has occured. <br /> <br />" +
- "Message: " + ex.Message;
- <!-- all the links for datetime picker -->
- <link rel="stylesheet" type="text/css" href="../style/jquery.datetimepicker.css"/ >
- <script src="../Scripts/jquery.js"></script>
- <script src="../Scripts/jquery.datetimepicker.js"></script>
- <script>
- $(function() {
- $( "#datetimepicker" ).datetimepicker();
- });
- </script>
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", " changeLabel('" + ex.Message + "', '" + lblError.ClientID +"'); alert('error !'); ", true);
- function changeLabel(text, id){
- $("#"+id).val(text);
- }
- try
- {
- ..
- }
- catch(Exception ex)
- {
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Database error ocurred : "+ ex.Message.ToString()+"')", true);
- }
- try
- {
- throw new Exception("test");
- }
- catch (Exception ex)
- {
- string message = string.Format("alert('A database error has occured. {0}');",
- ex.Message.Replace("'", ""));
- ScriptManager.RegisterStartupScript(this, this.GetType(),
- "alert" + UniqueID, message, true);
- }
- <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
- <div id="dialog" title="Basic dialog">
- <div id="dialog-text"></div>
- </div>
- try
- {
- throw new Exception("This is an error message.");
- }
- catch (Exception ex)
- {
- string message = string.Concat("$(function () {$('#dialog').dialog(); " +
- "$('#dialog-text').html('A database error has occured. " +
- "<br /> <br />", ex.Message, "');});");
- ScriptManager.RegisterStartupScript(this, this.GetType(),
- "alert" + UniqueID, message, true);
- }
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "<script language='javascript'>alert('A database error has occured.nn"+ ex.Message +"' );</script>", true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement