joecool2005 Posted July 10, 2007 Share Posted July 10, 2007 Hi,On this code <script language="VB" runat="server"> Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) empl.Text = "test" End Sub Sub display(ByVal sender As Object, ByVal e As EventArgs) Response.Write(empl.Text) End Sub</script><body onLoad="Page_Load" runat=server><form id="form1" runat="server"><asp:TextBox id="empl" runat="server"/><asp:Button id=Button1 Text="submit" runat="server" OnClick="display" /> </form></body> After loading, the initial value for "empl" is "test"But, when I type something else in the textbox and submit, how come the value is still test?How can I change the textbox value after typing?Thx Link to comment Share on other sites More sharing options...
aspnetguy Posted July 10, 2007 Share Posted July 10, 2007 the problem is in your Page_Load everytime the page loads the value is set to test, this includes PostBacks also so this will solve the problem Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) If Not IsPostBack Then empl.Text = "test" End IfEnd Sub Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.