******************** Edit 2 *********************** I understand the problem ... But I do not like the consequences. I previously tested the mobile app for iPhone using the Firefox User Agent String masking plugin as an iPhone.
.Net was infact NOT, generating the required code for post backs based on only this piece of information.
I don't like this because, because iPhone and other multimedia devices can interpret javascript, ASP.net breaks any application based on the javascript server running.
So, if the community resolves this ... I would like to change my official question ... Why won't ASP.net generate javascript for specific browsers and how can I disable this feature?
*************** End Edit 2 ***************
I have a strange problem. I copied some working code from my remote host to my computer at work. When I try to use the page, I get javascript error
__doPostBack is not defined javascript:__doPostBack('ctl00$ContentPlaceHolder1$login','')()()
When the source of the output page is not enough for me, I am sure that no javascript has been created on the server side.
I tried to create a simple page:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="jsTest.aspx.vb" Inherits="_jsTest" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:TextBox ID="tbTest" runat="server"></asp:TextBox><br /> <asp:LinkButton ID="linkTest" runat="server">LinkButton</asp:LinkButton> </form> </body> </html>
Codebehind:
Partial Class _jsTest Inherits System.Web.UI.Page Protected Sub linkTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles linkTest.Click Response.Write(tbTest.Text) End Sub End Class
Getting the same error.
I tried rebooting (hey, it works a half times), cleared everything from App_Code, global.asax and web.config, added a text box with autopostback = true ... I have no ideas.
Can anyone shed light on what is happening here?
************** Additional information *************** I just tried everything in IE, and it works as expected, shows the page source:
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTkxNTA2MDE2NWRkxhZMwlMVwJprcVsvQLJLrTcgaSM=" /> <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwK20LZAAuzRsusGAsz0+6YPxxO+Ewv1XsD5QKJiiprrGp+9a3Q=" /> </div>
So far, the source in Firefox only shows:
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTkxNTA2MDE2NWRkxhZMwlMVwJprcVsvQLJLrTcgaSM=" /> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwK20LZAAuzRsusGAsz0+6YPxxO+Ewv1XsD5QKJiiprrGp+9a3Q=" />
Saving web pages to the desktop and opening in notepad show the same thing ...