I am opening a ShowModalDialog on a button OnClientClick event and the javascript for it is:-
<script language="javascript" type="text/javascript">
function openmodalWinLunch() {
var variable1 = "Lunch";
window.showModalDialog("ClockPopUP.aspx?code=" + variable1, "dialogWidth:290px;dialogHeight:270px,");
}
On the Clock.aspx page i have a asp button on which i had written code :-
protected void btnStop_Click(object sender, EventArgs e)
{
_nonProduction = new NonProduction();
if (Session["LastNonProdTimeID"] == null)
{
}
else
{
int NonProdTimeEntryID = Convert.ToInt32(Session["LastNonProdTimeID"]);
//Updating the TimeSpent
isTimeSpentUpdated = _nonProduction.UpdateTimeSpentInDB(NonProdTimeEntryID);
if (isTimeSpentUpdated == true)
{
string timespent = Convert.ToString(_nonProduction.GetTimeSpent(NonProdTimeEntryID));
//string msg = "Total time consumed in " +HiddenTaskname.Value.ToString()+": " + timespent.ToString() + " Minutes";
Response.Write("<script language='javascript'>window.close();</script>");
Response.End();
}
else
{
}
}
}
Preveously every thing is working fine and this code is working as per my requirement. Just i had added Scriptmanager on the Clock.aspx as i m showing a clock which shows the elapsed time to the user. After that when i m clicking on the btn_Stop on CLock.aspx page i am getting this error message:-"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."
Please guide me that how i solve this issue.
I found that what is the root cause of this error. It is happening because i m using Resonse.Write and other information is Here
Guide me that how i fix this as i want to close the webpage after button click event.