By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,152 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,152 IT Pros & Developers. It's quick & easy.

.aspx page wont work!

P: n/a
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


Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
try using the asp:button server control and see if it works
"Paul M." <pa**@nospam.fsnet.co.uk> wrote in message
news:bg**********@news8.svr.pol.co.uk...
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



Nov 17 '05 #2

P: n/a
Make sure you have the "If Postback then exit sub" at the top of the
Page_Load procedure.

/john

"Paul M." <pa**@nospam.fsnet.co.uk> wrote in message
news:bg**********@news8.svr.pol.co.uk...
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



Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.