I have a textbox
and a dropdownlist
. The textbox is defaulted to 1
but if the user enters a different value into the textbox they must select a value from the dropdownlist
. If they do not select a value from the dropdownlist
then the exception
message appears, and the changes they made to the textbox will not be saved. The problem is the value in the textbox is still there when I reopen the page. If I manually refresh the page, then it defaults back to 1. So I am trying to refresh the page after the exception message appears, but if I put code to refresh the page after the exception then the message doesn't appear anymore.
How can I refresh the page after the user closes the exception message?
JobPieceSerialNo SerNo = new JobPieceSerialNo(job.ID);
if (SerNo.Reason == null)
{
throw new Exception("Must select reason");
}
catch (Exception ex)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "Message",
"<script>$(document).ready(function () { $(\"<div>" + "Please note : " + ex.Message + "</div>\").dialog({modal: true,title: \"NOTE\",buttons: [ { text: \"Ok\", click: function() { $( this ).dialog( \"close\" ); } } ]}); ShowHidePointToPoint('OVERNIGHT');});</script>");
Response.Redirect("Job.aspx?JobID=" + Request.QueryString["JobID"], false);
}