Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
1,623 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

704 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