IE input beeping - asp.net

I hope someone can help. My asp.net application is exhibiting strange behaviour. Whenever I press the Return/Enter key I get a series of beeps/dings. It sort of goes dindindidindindinggggg !
I have reproduced the issue with a small sample application:
<%# Page Language="Oxygene" AutoEventWireup="true" CodeFile="Default.aspx.pas" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server">
</asp:TextBox>
</form>
</body>
</html>
This only happens in IE, in firefox and chrome there is no beeping.
Also as a side issue, if I remove one of the textboxes then there is no dinging but I get a post back instead.
Anyone know what is going on here?
Thanks,
AJ

The enter key has submit behavior for forms. The sound you're hearing is Internet Explorer's way of saying that it could not submit the form, as there is no submit button.
This is nothing .NET specific, but rather an intrinsic part of how IE communicates with the user. A quick test, excuse the sloppy HTML:
A form with no submit button will beep when user tries to submit it:
<form><input /><input /></form>
Adding a submit button will get you the click sound of a form being submitted instead:
<form><input/><input/><input type="submit" /></form>
You can get rid of that sound by preventing the submit:
<form onsubmit="return false;"><input/><input/><input type="submit" /></form>
Then the only problem is that the button is showing, which, i guess, is not what you want. It turns out that hiding it will make the first sound re-appear, unsurprisingly:
<form onsubmit="return false;">
<input/><input/>
<input type="submit" style="display: none;"/>
</form>
Here, the button is hidden, and so the browser behaves as in the first scenario where there is no button. But if we hide it in a more elaborate way, so that the browser cannot be sure that it's not showing up, we can get around that problem too:
<form onsubmit="return false;">
<input/><input/>
<input type="submit" style="background-color: transparent; border: 0;" value="" />
</form>
Now, it should be noted that in this last solution, there'll still actually be a button there, that the user cannot see, but can click anyway (it won't submit, tho). I don't advocate this, but if you're going with this solution, you probably want to set width and height to something really small as well. My ambition was not to come up with the best hack, but simply to create a series of instructive examples that illustrates why the browser behaves the way it does given certain situations.

Well, you do not have a Submit button so it may be informing you that there is no automatic post-back handling. That would be my first guess.

I found the answer:
<%# Page Language="Oxygene" AutoEventWireup="true" CodeFile="Default.aspx.pas" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body onkeypress="if(event.keyCode==13)return false;">
<form id="form1" runat="server" onsubmit="return false;">
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server">
</asp:TextBox>
</form>
</body>
</html>
This stops the beeping and stops a post-back when only a single input element.

Related

AjaxControlToolKit v16.1.0.0 TabContainer

I upgraded to the latest version of AjaxControlToolKit and now none of my Ajax tab controls work. Previously they worked fine.
After the upgrade, my tab controls defaulted to invisible. I can force visibility with style="visibility:visible" in the tabContainer tag. Then it appears and looks ok, except that clicking on the tab headers does nothing. I tried setting them all with Enabled="True" with no effect.
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="test1.aspx.vb" Inherits="Myapp.test1" %>
<%# Register TagPrefix="ajaxToolKit" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="frmTest" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
<br /><br /><br /><br />
<ajaxToolKit:TabContainer ID="hello" runat="server" OnClientActiveTabChanged="TabChanged()" ActiveTabIndex="0">
<ajaxToolKit:TabPanel><HeaderTemplate>First Tab</HeaderTemplate>
<ContentTemplate>Text on first tab.</ContentTemplate>
</ajaxToolKit:TabPanel>
<ajaxToolKit:TabPanel><HeaderTemplate>Second tab</HeaderTemplate>
<ContentTemplate>Can't get this tab to appear.</ContentTemplate>
</ajaxToolKit:TabPanel>
</ajaxToolKit:TabContainer>
</form>
</body>
</html>
I needed to removed OnClientActiveTabChanged and ActiveTabIndex and it worked correctly. The older version was not so fussy and did not mind me having OnClientActiveTabChanged pointing to a missing function.
It is worth noting that I barked up the wrong tree for a long time because the problem seems to occur with ANYTHING is wrong with either the TabContainer or TabPanel tag. In my initial test code to try to identify the issue I stripped out everything and got the same problem without either of these two tags. However it turned out to be a different reason (I omitted runat="server" in the TabPanels).

html 5 pattern doesnt work when master page is attached to it

<%# Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="zzzz.aspx.cs" Inherits="zzzz" %>
<asp:Content ID="Content1" ContentPlaceHolderID="zzzz" Runat="Server">
<div class="form-group">
Country code: <input type="text" required="required" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code" class="form-group">
</div>
<input type="submit" class="form-group">
<p><strong>Note:</strong> The pattern attribute of the input tag is not supported in Internet Explorer 9 and earlier versions, or in Safari.</p>
</asp:Content>
Here pattern doesnt work i dont know why.. i tried all possible way to bring it, nothing helped me . I wanted to use patter to filter special character in the textbox. Please help me on this issue.. thank you..
It is working properly.
However, if you are running this page on IE, check what mode the browser is in. Simply press F12 and make sure it is set to IE10/Standard.
And if this is indeed the case, add/modify the following line to your Site.master:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
And this will fix this kind of problem.
Try this code its working perfectly
<html>
<body>
<form action="demo_form.asp">
Country code: <input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">
<input type="submit">
</form>
</body>
</html>
Enter invalid country code and click submit button. Then You can get a message (title="Three letter country code")

combobox items not displaying

This question has been asked here before, but the author wasn't very clear and got no answers (1st ref). Why aren't my combobox items displaying correctly? It is almost like they are there, but not connected to the combobox (notice my label, it shows up halfway down the page instead of right underneath the combobox when I run it). I get no errors on the page, which is good (different than when I tried doing this in VS2005), and the combobox displays fine, but when I click it, nothing is there.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:ComboBox ID="ComboBox1" runat="server" AutoPostBack="true"
DropDownStyle="DropDownList">
<asp:ListItem>thisis</asp:ListItem>
<asp:ListItem>mynetwork</asp:ListItem>
<asp:ListItem>getoffmyjunk</asp:ListItem>
<asp:ListItem>itsmine</asp:ListItem>
<asp:ListItem>illkillyou</asp:ListItem>
<asp:ListItem>forrealz</asp:ListItem>
<asp:ListItem>what</asp:ListItem>
<asp:ListItem>didyousaysomething</asp:ListItem>
<asp:ListItem>didn'tthinkso</asp:ListItem>
<asp:ListItem>meh</asp:ListItem>
</asp:ComboBox>
<br />
<asp:Label ID="lbl" runat="server">default text</asp:Label>
</div>
</form>
</body>
</html>
https://stackoverflow.com/questions/4322922/combo-box-items-does-not-display-below-of-combo-box-why
I'm having the same problem as this guy:
http://p2p.wrox.com/book-asp-net-ajax-programmers-reference-asp-net-2-0-asp-net-3-5-isbn-978-0-470-10998-4/80267-ajax-combobox-not-displaying-item-list-correctly.html
Your syntax looks to be incorrect for the ComboBox control. You want to use the Text and Value parameters in order to get the options to display. You'll want it to look like this:
<asp:ComboBox ID="ComboBox1" runat="server" AutoPostBack="true" DropDownStyle="DropDownList">
<asp:ListItem Text="thisis" Value="thisis"></asp:ListItem>
<asp:ListItem Text="mynetwork" Value="mynetwork"></asp:ListItem>
<asp:ListItem Text="getoffmyjunk" Value="getoffmyjunk"></asp:ListItem>
</asp:ComboBox>
Note: You may also be running into issues with your control tag declaration. For example, when I import the AJAX Control Toolkit into my applications, and add the proper references, I wind up using the tag "cc1" for all of the AJAX Control Toolkit controls. You may need to double check these references as well.
Use toolkitscriptmanager xDwanted to give the answer to Tim, but he won't put his comment as an answer ;;

asp net 4 - autopostback doesnt fire in ie6

OK, Im really stumped and hoping this is something simple. I have a form that relies on an autopostback of a radiobuttonlist to show or hide something. This was really elaborate at first and working fine, until I tested in IE6. The code below is as basic as I can get, all my code behind does is update the label to the radiobutton's selected value on click. This works in IE7 and 8, but not in IE6, what gives?
<%# Page Title="" Language="vb" AutoEventWireup="false" CodeBehind="testpostback.aspx.vb" Inherits="Checkout.testpostback" %>
<!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:RadioButtonList ID="radio1" runat="server" AutoPostBack="true">
<asp:ListItem Text="Check1" Value="Check1" />
<asp:ListItem Text="Check2" Value="Check2" />
</asp:RadioButtonList>
<asp:Label ID="label1" runat="server" Text="none" />
</form>
</body>
</html>
Take a look at the generated javascript in your web page and probably it uses new features of javascript that couldn't be executed by IE6.
Chances are you can debug the javascript and see what happens.
Consider that IE6 in XP Sp3 is not the same as IE6 in earlier XPs and it has less problems.
This came up in this question as well. It seems to be an IE6 bug.

Is there a simple way to have multiple ContentPlaceHolder controls update independently of each other?

This is a very simple ASP.NET master page example. The master page displays 4 hyperlinks and has two ContentPlaceholder controls. The first two links are to content pages that will display in ContentPlaceHolder1, the second two links are to content pages that will display in ContentPlaceHolder2.
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="ProofOfConcept.Site1" %>
<!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">
<div>
<h1>
Demo site
</h1>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/HeadContent1.aspx">Head Content 1 in ContentPlaceHolder1</asp:HyperLink>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/HeadContent2.aspx">Head Content 2 in ContentPlaceHolder1</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/MainContent1.aspx">Main Content 1 in ContentPlaceHolder2</asp:HyperLink>
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="~/MainContent2.aspx">Main Content 2 in ContentPlaceHolder2</asp:HyperLink>
<br />
<div style="border: 1px dotted blue;">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
This is default text for ContentPlaceholder1
</asp:ContentPlaceHolder>
</div>
<br />
<div style="border: 1px dotted red;">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
This is default text for ContentPlaceholder2
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</body>
</html>
The four content pages themselves all look like this:
<%# Page Title="" Language="C#" MasterPageFile="~/Site1.master" AutoEventWireup="true" CodeBehind="MainContent1.aspx.cs" Inherits="ProofOfConcept.MainContent1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceholder2" runat="server">
This is text from MainContent1 in ContentPlaceholder2
</asp:Content>
...with the ContentPlaceholder ID setas appropriate. In other words, each content page only contains one Content control linked to the one of the ContentPlaceHolders on the Master page.
If I build the site and load HeadContent1.aspx (the first link), for instance, only the content from HeadContent1 is displayed (plus markup from the master page, obviously). If I click the third link, content in the second ContentPlaceHolder is displayed, but the first Placeholder reverts to its default markup.
This behaviour all appears to be as designed and is undoubtedly very useful in many scenarios, but what I'd like to do is have the two ContentPlaceholders refresh independently of each other. To work like old-fashioned HTML frames, more or less? Is this possible, or should I be using some other control (or a different setup instead of Master/Content)?
I would say you want to use iframes for your situation. Master pages don't function the way you are looking for.
I agree with Mike. You are going the long way around. In order for your example to work with Master Pages, you will need 16 different content pages. Each page would need to fill the content for PlaceHolder1 and PlaceHolder2 depending on which links were clicked and in what order.
An IFrame would be a better way to handle something like this, but I would first recommend you review your design to determine if there is a way that it can be simplified.

Resources