.aspx page wont work!

P

Paul M.

Hi,
I am trying to run a simple asp .net page that has a button and a text
box on it. When the user clicks on the button the text box has some text put
into it. But it doesnt even fire the button click event when the button is
clicked on the text box remains unchanged.

Anyone got any ideas? Below is the code & html.

Thanks in advance
Paul M.

====================================
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm2.aspx.vb"
Inherits="PLDB_WWW.WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<INPUT id="Button1" style="Z-INDEX: 101; LEFT: 7px; WIDTH: 58px;
POSITION: absolute; TOP: 33px; HEIGHT: 186px" type="button" value="Button"
name="Button1" runat="server">&nbsp;&nbsp;
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 157px; POSITION:
absolute; TOP: 39px" runat="server" Width="289px" Height="190px"
ForeColor="Black">wwwwwwww</asp:TextBox>
</form>
</body>
</HTML>
====================================
Public Class WebForm2

Inherits System.Web.UI.Page

Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

Protected WithEvents Button1 As System.Web.UI.HtmlControls.HtmlInputButton

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick

TextBox1.Text = "Success"

End Sub

End Class
 
J

John Knoop

Make sure you have the "If Postback then exit sub" at the top of the
Page_Load procedure.

/john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top