|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
get text from a textbox
I have a problem with getting a text from the textbox.<br> The textbox has a default text got from the Page_Load event. Then I change the text in the textbox and click a "Save" button. When I try to get the newly entered text in the button_Click event, I see that I still get the old (default) text. <br> How can I get the latest value of the textbox?<br> Please, any ideas......
|
|
#2
|
|||
|
|||
|
Hi,<br><br>if Not IsPostBack<br><br>/// your code of assigning default value to text box<br><br>End If<br><br>put this code in your page load event.<br><br>All the best.<br><br>K****ij.
|
|
#3
|
|||
|
|||
|
Where are you saving the information in the textbox?<br>SQL?<br>Access?<br><br>All you need to do is read the data from the datastore with a datareader and assign the textbox its value.<br><br>For instance, if its in sql, just get the value you want with a sql reader using <br><br>strSQL = "SELECT Value FROM table WHERE object = identifier"<br>use your connection pass the string, return the value<br><br>if you are using a datatable, its as easy as just using<br><br>if not ispostback<br> textbox.text = datatable.rows(0)("cell")<br>end if<br><br>Rows(0) is the returned single row of the select results, the cell is the name of the column in the database.<br><br>Hope this helps.
|
|
#4
|
|||
|
|||
|
Sub Page_Load(Sender As Object, E As EventArgs)<br> if request.form("ur_textbox") <> "" then<br>message="ur text is : '"&request.form("ur_textbox")&"' "<br>else message="write ur new text"<br>end if<br> End Sub<br><br><br><br>hope this helps too
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > get text from a textbox |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|