• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1937
  • Last Modified:

Why am I getting an "Unexpected token" error on the HTML generated from my AjaxToolkit:NumericUpDownExtender on my ASPX page in IE11

Hi:

I've got an ASP.Net webpage which uses the AjaxToolkit NumericUpDownExtender.

I've been testing/debugging using Chrome and IE 11.
In IE11, I am getting some errors on the generated HTML on the page. Everything looks OK in Chrome.
I'm not sure if this an issue or not, but I would like to understand what is going on and how to correct it.

The HTML on the original ASPX page looks like this:
<ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" TargetControlID="txtQuantityOfCases"
  Minimum="1" Width="120" TargetButtonDownID="imgDown" TargetButtonUpID="imgUp" ClientIDMode="Static" />
<asp:TextBox ID="txtQuantityOfCases" runat="server" Style="text-align: center" Text="1" Width="20px" ClientIdMode="Static"/>
<table id="Table1">
  <tr>
     <asp:ImageButton ID="imgUp" runat="server" ImageUrl="~/images/NumericUpDown/up.gif" 
       AlternateText="Down" Width="7px" Height="7px" BorderStyle="None" />
  </tr>
  <tr>
     <asp:ImageButton ID="imgDown" runat="server" ImageUrl="~/images/NumericUpDown/down.gif"
       AlternateText="Up" Width="7px" Height="7px" BorderStyle="None" />
  </tr>
</table>

Open in new window

In Chrome, the HTML on the rendered page looks like this:
<input name="ctl00$MainContent$txtQuantityOfCases" type="text" value="1" id="txtQuantityOfCases" style="width:20px;text-align: center">
<input type="image" name="ctl00$MainContent$imgUp" id="MainContent_imgUp" src="../images/NumericUpDown/up.gif" alt="Down" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$imgUp&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" style="border-style:None;height:7px;width:7px;">
<input type="image" name="ctl00$MainContent$imgDown" id="MainContent_imgDown" src="../images/NumericUpDown/down.gif" alt="Up" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$imgDown&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" style="border-style:None;height:7px;width:7px;">

Open in new window


It appears to work fine with no errors
In IE11, the HTML on the rendered page looks this:[
<input name="ctl00$MainContent$txtQuantityOfCases" type="text" value="1" id="txtQuantityOfCases" style="width:20px;text-align: center" />
<table id="Table1">
  <tr>
    <input type="image" name="ctl00$MainContent$imgUp" id="MainContent_imgUp" src="../images/NumericUpDown/up.gif" alt="Down" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$imgUp&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" style="border-style:None;height:7px;width:7px;" />
  </tr>
  <tr>
    <input type="image" name="ctl00$MainContent$imgDown" id="MainContent_imgDown" src="../images/NumericUpDown/down.gif" alt="Up" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$imgDown&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" style="border-style:None;height:7px;width:7px;" />
  </tr>
</table>

Open in new window


It displays the following errors in the IE debugging tool:
HTML1506: Unexpected token.
File: MakePTILabelWithSerialNumber.aspx, Line: 312, Column: 69
HTML1506: Unexpected token.
File: MakePTILabelWithSerialNumber.aspx, Line: 315, Column: 69

Open in new window

Where lines 312 and 315 line up with the generated HTML input control.

Can someone help shed some light on this?

Thanks,
JohnB
0
jxbma
Asked:
jxbma
  • 3
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
replace &quot; by '
0
 
jxbmaSoftware ConsultantAuthor Commented:
Remember the generated HTML is what is causing the error.
That HTML is generated once the ASPX page is compiled into HTML.
I don't (or at least I don't know of a way to) have control over what the generated HTML looks like.

JB
0
 
leakim971PluritechnicianCommented:
so maybe you can put a function in a script tag.

<script type="text/javascript" language="javascript">
function doThat(el) {
      var nw = new WebForm_PostBackOptions(el.getAttribute("name"), "", true, "", "", !0, !0);
      WebForm_DoPostBackWithOptions(nw);
}
</script>

Open in new window


and use :
onclick="doThat(this)"
0
 
jxbmaSoftware ConsultantAuthor Commented:
leakim971:


Thanks for the response. Yes, I believe that would work.

For me I guess I'm confused/concerned as to why code generated by the AjaxToolkit (Microsoft) doesn't work as is out of the box in a browser written by (Microsoft).

JB
0
 
leakim971PluritechnicianCommented:
lol, I think MS itself don't know, too much people in the box...
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now