472,146 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

ASP.NET 2.0 Default Button problem


I have a simple test form with a panel and default button defined,
textbox, RequiredFieldValidator. If i open the form and press enter the
RequiredFieldValidator will prevent the form to be submittet but if i
press enter a second time the form will be submitted and
RequiredFieldValidator will be ignored. Is this by design? or how do i
prevent the form to be subbmitted a second time

// Mats

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form defaultfocus="TextBox1" id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" DefaultButton="Button1"
Height="218px" Width="428px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button"
ValidationGroup="1" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TextBox1"
ErrorMessage="RequiredFieldValidator"
ValidationGroup="1"></asp:RequiredFieldValidator></asp:Panel>

</div>
</form>
</body>
</html>

Oct 23 '06 #1
0 1017

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Morten | last post: by
3 posts views Thread by Marty McFly | last post: by
3 posts views Thread by Rick Brandt | last post: by
1 post views Thread by andyrich_1 | last post: by
1 post views Thread by JJ | last post: by
6 posts views Thread by =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post: by
reply views Thread by =?Utf-8?B?bmVlcmFqYkBub2lkYS5ub3NwYW1oY2x0ZWNoLmNv | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.