Javascript ; Expected error RRS feed

  • Question

  • I am getting a Javascript error Expected';' on below code.Please help me understand why am I getting this error? Below is my rendered HTML code:

    <td style="width: 152px; height: 64px" align="center">
      <input onclick="this.disabled=true;__doPostBack('btnSubmit','') if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate('submit'); " name="btnSubmit" type="submit" id="btnSubmit" tabindex="25" title=" Submit Request" style="background-repeat:no-repeat;text-align:center;width:148px;background-height:31px;color:white;background-image:url(images/submit.bmp);background-color:lime;cursor:hand;"
        value=" " ValidationGroup="submit" />

    This is what the element looks like:

      <td style="width: 152px; height: 64px" align="center">
        <input id="btnSubmit" tabindex="25" title=" Submit Request" style="background-
                                                                                background-image: url(images/submit.bmp); width: 148px; cursor: hand; color: white;
                                                                                background-repeat: no-repeat; height: 31px; background-color: lime; text-align: center" type="submit" value=" " name="frmSubmit" runat="server" onserverclick="Btn_SubmitClick"
          causesvalidation="True" validationgroup="submit">

    With btnSubmit attribute added on page load

    private void Page_Load(Object src, EventArgs e) 
    btnSubmit.Attributes.Add("onClick", "this.disabled=true;" + GetPostBackEventReference(btnSubmit,string.Empty).ToString());
    btnSubmit.Style.Add("cursor", "hand"); 
    Thanks in Advance!

    • Edited by Snigdha_1014 Tuesday, September 26, 2017 8:23 PM
    Tuesday, September 26, 2017 8:23 PM

All replies

  • Tuesday, September 26, 2017 9:31 PM
  • Have you tried stepping through the code in your web browser developer tools which is a good way to determine what's going on.

    If using ASP.NET in VS2017 you can debug right from Visual Studio rather than a web browser developer's tools.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, September 26, 2017 9:57 PM