title: Microsoft JScript runtime error: Only properly formatted script tags can be registered
body: <p>I am having a web page and i applied script manager on it. On the page load i am checking some condition and showing a Javascript ShowModalDialog from code and it is working fine.</p>
  
  <pre><code>int isAnyNonProdTaskActive = _nonProduction.IsAnyTaskActive(UserIDFromDB);
              if (isAnyNonProdTaskActive &gt; 0)
              {
                  //Displays and Logs Message
                  _loggerDetails.LogMessage = "EmployeeQuotient.Production.Page_Load()     One NonProduction incomplete task found, NonProductionTimeEntryID : " + isAnyNonProdTaskActive.ToString();
                  _writeLog.LogDetails(_loggerDetails.LogLevel_Info, _loggerDetails.LogMessage);
  
                  Session["TaskActiveNonProd"] = isAnyNonProdTaskActive;
                  Page page = HttpContext.Current.CurrentHandler as Page;
  
                  //Displays and Logs Message
                  _loggerDetails.LogMessage = "EmployeeQuotient.Production.Page_Load()     Opening ElapsedClockNonProd.aspx to complete the incomplete task id :" + isAnyNonProdTaskActive.ToString();
                  _writeLog.LogDetails(_loggerDetails.LogLevel_Info, _loggerDetails.LogMessage);
  
                  ScriptManager.RegisterStartupScript(page, page.GetType(), "OpenModalDialog", "&lt;script type=text/javascript&gt;window.showModalDialog('ElapsedClockNonProd.aspx?code=" + isAnyNonProdTaskActive.ToString() + "', null, 'unadorned:yes ;resizable:0 ;dialogWidth:300px ;dialogHeight:300px ;status:no ;scroll:no ;status=no;'); &lt;/script&gt;", false);
              }
  </code></pre>
  
  <p>The same code i am applying on a Button on the same page then i am getting error.The error message is :-  Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The script tag registered for type 'ASP.associates_production_aspx' and key 'OpenModalDialog' has invalid characters outside of the script tags: window.showModalDialog('ElapsedClockNonProd.aspx?code=464', null, 'unadorned:yes ;resizable:0 ;dialogWidth:300px ;dialogHeight:300px ;status:no ;scroll:no ;status=no;'); . Only properly formatted script tags can be registered.</p>
  
  <p>Guide me that how i fix this error.I am not getting that why on the button click it is not working but while page load the same script is working without any issues..</p>