get the changed value of a text box - client side

Hello everybody!

I have this in the server side:
<asp:textbox id="TEscala" runat="server"></asp:textbox>
<asp:imagebutton id="BIrEscala" runtat="server" imageurl="images/irmapa.gif"> </asp:imagebutton>
And i want to do this:
Private Sub BIrEscala_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles BIrEscala.Click
Dim xx As String
xx = Tescala.value
End Sub
The problem is that "xx" doesn´t get the new value written in the text box.
I know that i can get the value using Javascript , but i need that value to use it in the aspx.vb code.
how can i do it?
Thanks.
0
juanlucs
3/18/2004 10:40:48 AM
asp.net.client-side 24353 articles. 1 followers. Follow

9 Replies
813 Views

Similar Articles

[PageSpeed] 20

I think that the problem is that the form has been posted and the Page_Load function has been executed, then the textbox's value has been emptied.

Maybe you can use the Request.Form ?
(but then I think you have to get the clientId on the textbox, which can differ from the server-side ID)
0
MagnusHansson
3/18/2004 11:51:52 AM
There is no value property for a Textbox. You need to use the text property.

Ex.
Dim xx As String
xx = Textbox.Text
0
wolfcw1
3/18/2004 1:29:10 PM
Sorry 

I 've writed wrong the message.
in the code i have:
Dim xx As String
xx = Textbox.Text
Magnus , i dont understand you about how can i get the clientId on the textbox?
0
juanlucs
3/18/2004 1:47:00 PM
I know that i can do it with JavaScript in the client side, changing

<asp:input ... to <input ..
and
<asp:button ... to <button .... onclick=getvalue();
and in the function getvalue(), i can call the aspx form passing the value, but this will reload aspx the page , isn't it?
And i don't want reload the page.
Any idea?
Thanks in advance.
0
juanlucs
3/18/2004 3:00:24 PM
Your original post works fine for me. 

Just for clarification I have the following in the .aspx page:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Test.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="TEscala" runat="server"></asp:TextBox>
<asp:ImageButton id="BIrEscala" runat="server"></asp:ImageButton></form>
</body>
</HTML>
And the following in the codebehind (.aspx.vb):
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents TEscala As System.Web.UI.WebControls.TextBox
Protected WithEvents BIrEscala As System.Web.UI.WebControls.ImageButton
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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
'Put user code to initialize the page here
End Sub
Private Sub BIrEscala_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles BIrEscala.Click
Dim xx As String
xx = TEscala.Text.ToString()
Response.Write(xx)
End Sub
End Class
1
wolfcw1
3/18/2004 11:53:06 PM
It doesn't work for me.

I have the code as yours.
Do you get written a the new value of the textbox?. I get the old value.
Supose that the page is loaded.
And the text box value is: "180.00".
Now i change the value to e.g. "30.00", and when i click the botton y get a "180.00", The old value.
I think that it is because is a server control and to change to value the page need to be reloaded. But i would like get the new value without reload the page. Is it posible?
Thanks in advance.
0
juanlucs
3/22/2004 7:58:25 AM
Are you sure you're not re-initializing the value somewhere in your codebehind?
0
stiletto
3/22/2004 12:29:20 PM
Thanks

You are right.
I didn't noticed that the Page_Load(), executes befere BIrEscala_Click(), and in the Page_load i change the value too.
Thanks again.
0
juanlucs
3/22/2004 2:22:43 PM

Also, you should notice that the readonly property will reset a textbox at pageload.

Have a look here http://geekswithblogs.net/ranganh/archive/2007/05/10/112390.aspx.

 Essentially it's about adding the readonly property at run-time e.g:

  if (!IsPostBack)
        {
            // make textbox read-only
            TextBox1.Attributes.Add("readonly", "readonly");

        } 

0
johannesdolberg
12/5/2007 11:42:33 AM
Reply:

Similar Artilces:

How do I get text areas side by side?
I'm quite new to VWD, and I can't seem to figure out how to do the simplest things.  For one thing, in design view, I can't seem to be able to type a block of text and keep it part of the same box, or frame or whatever - as soon as I hit enter I get a new box to type in.  And it doesn't really let me move it around how I want, it's just, weird.   Why does it only allow you to size the box from the right?  My specific problem, at the moment, is that I can't seem to figure out how to add areas of text next to each other.  I want to be...

cant get text of text box when it dissabled(value changed by javascript)
hi I cant get the text property of texbox properly, if its dissabled. I can get the value if i changed it with server script but i cant get  value when i tried to change the value by client side script(javascript)    this works for me:  <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script type="text/javascript">window.onload = function(){ var textbox = document.getElementById('<%= MyTextBox.ClientID %>'); // change value from the textbox ...

Side By Side
Can the mail view be set up side by side instead of over(Subject ...) / under (message)? On 11/13/13 3:44 PM, OldGuy wrote: > Can the mail view be set up side by side instead of over(Subject ...) / > under (message)? Try View > Layout > Vertical View Is that what you want? -- Ken Mac OS X 10.8.5 Firefox 24.0 Thunderbird 17.0.8 LibreOffice 4.1.2.3 OldGuy wrote: > Can the mail view be set up side by side instead of over(Subject ...) / > under (message)? These are the names of the panes in a layout http://kb.mozillazine.org/Window_layout_-_Thunder...

How to get control value changed by javascript unload event in server side?
I use javascript to change the value of a HtmlInputHidden control during window.onunload event. However, the ASP.NET server side code can only get the value before the change. How can this be solved?   Hi, the clientside event "onunload" occurs at all times when the user navigate to a new page. A postback is not effected every time after the onunload event. Try to use the onsubmit event and attach an event method at the end of the page, e.g.: </body> <script> window.document.form1.attachEvent("onsubmit", SetValue); </script> </html>RegardsMarc A...

Problem while setting the value of a server side text box using ajaxpro
Dear Friends, I have a problem using the Ajax.NET Pro when i try to access a control or a data member in a server side class from the ajaxpro method (that declared using the attribute [AjaxPro.AjaxMethod],it giving object is nothing.Please if any one have answer for this,let me know   Regards Ravishanker Maduri MCTS,MCPD,MCAD,MCPRavishankar Maduri     Dear friends,         i got resolved the above problem,in the ajax pro method return datatable,and add the below function,it works for both firefox and IE also.      &nb...

Unable to Read value of readonly text box at server side code
Hi, I have a text box which have read only property true.. I am filling it with java script Calender control at the client side. Further i am trying to read its value on button click event at server side, but at sever side i m not able to read its value.. I have serached a lot on net and found following work around which is not working in my case... 1) on page load i have tried textbox1.Attributes.Add("readonly", "readonly"); 2) In the below code it is not able to find my text box at c.GetType().ToString() Loccation foreach (Control c in pg.Form.Contro...

Side by Side Execution of .net v1.1 and .net v2.0
Hi i am new bie to asp.net 2.0.Till date i have been developing projects using VS.Net 1.1 and now i hv decided to upgrade to new version 2.0.Now i want to run and develop my projects using any of the versions as desired.My question is that can i install vs 2.0 without updating the previous version and will i be able to develop and run my applications in any of the versions as desired.i have been known that we can run these versions side by side(i.e. one application can use 1.1 and other 2.0),but can we do side by side development as well(i.e. one application can use 1.1...

How to get the text of label which is changed by dropdown list through javascriptin server side aspx.cs file
Hi, I have a dropdown list suppose there are 4 items in that and ther values  are 1,2,3,4 an text are one ,two ,three,four   on changing dropdownlist iam making the text of label equals to the dropdownlist current selected value through javascript i have a asp.net label  and asp.net button control now i want the text of this label on the code behind of asp.net button click event ie in aspx.cs file the text of label is changing on changing dropdown list the problem is that its effect are not catched in the button control click event ie its label.text  value remai...

How do you get two items side by side?
I know this is more of a css question rather then a asp.net question so I appoligize but this is really starting to get on my nerves I am trying to put two items side by side with a bit of a margin in between them however they are not going side by side they keep getting put one under the other.....I am using masterpages and content pages. here is the part of the code in which I am trying to get these two product reviews to align side by side.<div id="page_maincol"> <div id="maincol"> <div class="content_header"> Welcome To ...

Side by Side Execution of .net v1.1 and .net v2.0 (continued)
Hi, Dave wrote a previous post that said: "If you are referring to web applications - each Virtual server must specify the framework to run under.  Both can run side-by-side.. but not under the same virtual server (application pool)" That looks fine, but I wonder: Is it just as easy as going to Administrative Tools --> IIS --> Select the virtual directory --> go to the property's ASP.NET tab and then selecting the ASP.NET version? Is there some important information that I need to know before going into this? Are there going to be ANY issues I should be aware of? T...

running .net framework side by side
Does anyone know how to run the .net framework side by side on the same box? Didn't you already post this?Have you installed both?  That's really about all it takes.  You have to select the version for the app using the ASP.NET tab, and 1,1 apps don't run in 2.0 and vice versa, but it's not really rocket science.  Where are you having problems?JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Server-side change to text box trigger causing "late" TextChanged event on postback
I have a page that has two text boxes on it, and an update panel with some content.  If the user changes one text box, the other is adjusted accordingly, and vice versa.  Both text boxes are defined as asyncpostbacktriggers for the update panel, and have AutoPostBack = true. The problem I am having is as follows.  The user changes textbox1.  I get an async textbox1_TextChanged event.  In the event procedure, I change textbox2, and update the UpdatePanel content.  All good.  But on a subsequent change to textbox1, I am getting a textbox2_TextChanged event.&...

Side by side text compare tool with colors
Hi, I want to compare two texts next to each other (like Beyond Compare), and display the differences in colors. I've been looking for code samples and controls, but I can't find any! It seems to me a quite difficult task to build such a thing myself - it's difficult to scan for differences since you have to detect where the second text matched the first text again after a difference has occurred. Does anyone know if there is a control that is able to do this, or a code sample to compare two texts? Cheers, McAnic What do you mean display the difference in colours? And what ...

Orcas and VS.net 2005 side by side
I haven't installed the latest just yet - - I have questions  With the current framework (3.0), and with the upcoming 3.5 that will be available with future betas of Orcas (I assume), is it possible to have VS.net 2005, (and the latest version of Orcas and the underlying additions to the framework), side by side on the same machine, so I can continue developing my current workload, while at the same time, check out the new stuff? Yes, you can have both running side-by-side. There were some minor problems in this configuration with Beta 1, but Beta 2 will be out in a few weeks, an...

How can I get two sections side by side
Like the top of an invoice where you might see on the left a bordered section for client info and on the left shipping or billing info. I would like to have two sections bordered with a label at the top left indicating what is in the sections. Is this possible with asp.net controls or what other ways can I do this? Not a very good example, best I can do with this editor. The sections would be completly bordered ---Client------------                        ...

Web resources about - get the changed value of a text box - client side - asp.net.client-side

The Day the Universe Changed - Wikipedia, the free encyclopedia
The Day the Universe Changed (subtitled "A Personal View by James Burke") is a British documentary television series written and presented by ...

How Has Facebook Changed News Delivery?
... cats — it altered the way stories are seen. Now everyone can make news. But for those who make a living by spreading news, Facebook has changed ...

Facebook changed my name to my unknown birth name, not my current legal name... - Facebook-Hilfeforum ...
I provided Facebook with my original birth certificate and my name change certificate - instead they changed my name to my birth name which I ...


West Wing Changed Me (@WWChangedMe) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Changed the AWS instance size on the Trex server from small to large, and now it runs much better. ;-) ...
A bunch of people made suggestions after reading today's Changes piece. The one that made the big difference came from my longtime programming ...

Economics : How has introductory economics changed as it's been taught in American universities over ...
Answer (1 of 5): Introductory economics has not changed enormously over the years. In part this is because much of introductory economics is ...


Knuckle Up #398: UFC 178, Cry Babies, HeadGames + Suddenly Your DNA Is Forever Changed… (MMA Nation) ...
Literary gunslinger Eugene S. Robinson of http://BloodyElbow.com lends his one-of-a-kind perspective on UFC 178 up to and including the TEARS ...

The one realisation that changed my life
One realisation has changed my life.

Resources last updated: 11/29/2015 1:11:35 PM