Textbox change
Textbox change
Textbox change
Textbox change
Textbox change
Textbox change Textbox change Textbox change Textbox change Textbox change Textbox change Textbox change Textbox change
Textbox change Textbox change
Textbox change
Go Back  Xtreme Visual Basic Talk > > > Textbox change


Reply
 
Thread Tools Display Modes
  #1  
Old 10-19-2005, 08:51 AM
tware tware is offline
Regular
 
Join Date: Sep 2004
Location: Maryland
Posts: 59
Default Textbox change


Hello Everyone,

I have an ASP.NET form and there is one textbox on the form. When I change the text in the texbox I can't retrieve the new text I keep getting the old text. How do I get the new text?

Thanks,

Trena
Reply With Quote
  #2  
Old 10-19-2005, 10:20 AM
wayneph's Avatar
waynephTextbox change wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Can you post the code you're trying to use? That would help us greatly in figuring out what you're doing.

My guess is that you're setting the value in your page_load event, so each time the page fires, you're replacing the new value with the old one. But that's just a guess.

You can put your .aspx (and .aspx.vb if using one) file in a zip file and attach it. That would be the easiest way to help you.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 10-19-2005, 11:09 AM
tware tware is offline
Regular
 
Join Date: Sep 2004
Location: Maryland
Posts: 59
Default

This is the code behind the form (ASP.NET):
<tr>
<td style="WIDTH: 1px; HEIGHT: 26px" Color="#0066ff"><asp:label id="label3" style="FONT-SIZE: 10pt; COLOR: #ffffff; FONT-FAMILY: Arial, Tahoma, Verdana, Helvetica" Runat="server" width="72px">Name</asp:label></td>
<td style="HEIGHT: 26px"><asp:textbox id="txtcategorydesc" Runat="server" width="333px"></asp:textbox></td>

</tr>

This is the VB.NET Code (changedtext is a global variable in the form):

Private Sub txtcategorydesc_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtcategorydesc.TextChanged

cat_changed = True
changedtext = txtcategorydesc.Text
End Sub


I'm looking at my code and what you said I believe you are correct. How do I fix it?

Trena
Reply With Quote
  #4  
Old 10-19-2005, 11:23 AM
wayneph's Avatar
waynephTextbox change wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Quote:
Originally Posted by tware
Private Sub txtcategorydesc_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtcategorydesc.TextChanged

cat_changed = True
changedtext = txtcategorydesc.Text
End Sub
This event is only going to fire if you have the AutoPostBack set to true. If you are using a button to submit the form or something like that, this code won't run. Just a warning.

Quote:
Originally Posted by tware
I'm looking at my code and what you said I believe you are correct. How do I fix it?
Anything you want to run just the 1st time a page is loaded you need to put in a "If Not IsPostBack Then" block.

Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load 'Put user code to initialize the page here 'Anything outside the If block will run every time the page is loaded If Not IsPostBack Then 'Put Code Here that should run only the first time End If End Sub
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #5  
Old 10-19-2005, 11:49 AM
tware tware is offline
Regular
 
Join Date: Sep 2004
Location: Maryland
Posts: 59
Default

Thanks!!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Textbox change
Textbox change
Textbox change Textbox change
Textbox change
Textbox change
Textbox change Textbox change Textbox change Textbox change Textbox change Textbox change Textbox change
Textbox change
Textbox change
 
Textbox change
Textbox change
 
-->