[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Steve

1/13/2003 8:02:00 PM

I'm and old hand at ASP and VB programming but new to
ASP.NET

I've been playing with forms and validation etc but I have
three problems.

1) How do I set the default focus to a
control on loading
2) When I press the tab key when the address
bar has the focus, the focus goes no nowhere. Then
pressing the tab again gets the focus to the textbox.
Where is the focus going on the first press?
3) When the textbox has the focus, pressing
the reurn key reloads the page!


Below is some skeliten code I've used to try to get to the
bottom of this.

Any thoughts anybody



<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="first.WebForm1"
EnableSessionState="False"%>
<HTML>
<body>
<form id="Form1" method="post"
runat="server">
<asp:TextBox id="TextBox1"
runat="server" tabIndex="1" MaxLength="5"
Rows="1"></asp:TextBox>
</form>
</body>
</HTML>



using System;

namespace first
{
public class WebForm1 : System.Web.UI.Page
{
protected
System.Web.UI.WebControls.TextBox TextBox1;

private void Page_Load(object sender,
System.EventArgs e)
{
Response.Write(TextBox1.Text);
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this.Load += new
System.EventHandler(this.Page_Load);

}
#endregion
}
}
.