Solved

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

Posted on 2014-09-02
5
1,022 Views
Last Modified: 2014-09-07
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
Comment
Question by:jxbma
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 40300753
replace &quot; by '
0
 
LVL 1

Author Comment

by:jxbma
ID: 40301461
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
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40301513
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
 
LVL 1

Author Comment

by:jxbma
ID: 40301726
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
 
LVL 82

Expert Comment

by:leakim971
ID: 40301745
lol, I think MS itself don't know, too much people in the box...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now