473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Retreiving old value from WebControls.TextBox with OnTextChanged

I would like to capture the previous value of a WebControl.TextBox in the
OnTextChanged event. I can't seem to find anything online about discovering
this value.

Thanks in advance
MS
Nov 19 '05 #1
3 2252
I believe that it's lost. You'll need to store the value somewhere
yourself...

string value = "oldPassword"
txtPassword.Text = value;
ViewState.Add("originalPassword", value)
OnTextChange
string newValue = txtPassword.Text
string originalPassword = (string)ViewState["originalPassword"]
...
end
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Mark Siffer" <ma*********@sbcglobal.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I would like to capture the previous value of a WebControl.TextBox in the
OnTextChanged event. I can't seem to find anything online about discovering this value.

Thanks in advance
MS

Nov 19 '05 #2
But it must be retrievable somewhere right? How else would the
OnTextChanged event get raised?
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OJ*************@TK2MSFTNGP09.phx.gbl...
I believe that it's lost. You'll need to store the value somewhere
yourself...

string value = "oldPassword"
txtPassword.Text = value;
ViewState.Add("originalPassword", value)
OnTextChange
string newValue = txtPassword.Text
string originalPassword = (string)ViewState["originalPassword"]
...
end
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Mark Siffer" <ma*********@sbcglobal.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I would like to capture the previous value of a WebControl.TextBox in the OnTextChanged event. I can't seem to find anything online about

discovering
this value.

Thanks in advance
MS


Nov 19 '05 #3
The value is maintained in viewstate, but it's simply overwrites the Text
property on postback...i don't know of a good way to dig inside the
viewstate to get the value...you could certainly look at Denis Bauer's
Viewstate viewer and you might get some
hints...http://www.denisbauer.com/ASPNETControls.aspx

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Mark Siffer" <ma*********@sbcglobal.net> wrote in message
news:eB*************@TK2MSFTNGP15.phx.gbl...
But it must be retrievable somewhere right? How else would the
OnTextChanged event get raised?
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OJ*************@TK2MSFTNGP09.phx.gbl...
I believe that it's lost. You'll need to store the value somewhere
yourself...

string value = "oldPassword"
txtPassword.Text = value;
ViewState.Add("originalPassword", value)
OnTextChange
string newValue = txtPassword.Text
string originalPassword = (string)ViewState["originalPassword"]
...
end
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Mark Siffer" <ma*********@sbcglobal.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I would like to capture the previous value of a WebControl.TextBox in the OnTextChanged event. I can't seem to find anything online about

discovering
this value.

Thanks in advance
MS



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brian Morris | last post by:
I'm new to .NET and just trying a few things out, like emailing. I created a form in Visual Studio .Net to input some information for generating an email and I'm getting the following error when it...
2
by: Benedict Teoh | last post by:
I created a dropdownlist containing day, month and year field and expose a property to assign a date. When I call from a aspx page and assign the value, the new date is not displayed until a submit...
6
by: Henri | last post by:
Very strange problem : if I write: <asp:TextBox runat="server" id="myBox" /> the control's ViewState stays always empty, so it loses its properties if it's not always displayed. But if I...
2
by: tshad | last post by:
Is there a way to raise an event when a user exits a textbox? I tried OnTextChanged and that doesn't seem to do it. <asp:textbox id="email" TextMode="SingleLine" OnTextChanged="checkRecords"...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
1
by: OceanBreeze | last post by:
I am using ASP 2.0 and C# I have a TextBox control in .aspx file. <asp:TextBox ID="CityTxt" runat="server"></asp:TextBox> When I click on that text box, I want to trigger onClick event. ...
4
by: preeti13 | last post by:
Hi friends i have a probelm i am try to pass the value to the employeeid parameter but getting th error please help me how i can do this i am getting the error here is my code using System;...
2
by: preeti13 | last post by:
Hi guys i am here with my another probelm please help me.trying insert the value into the data base but getting the null value error .I am getting thsi error Cannot insert the value NULL into...
7
by: adiel_g | last post by:
Hello Everyone, I created a custom control. On the CreateChildControls, I added a textbox to the control as follows: // TextBox TextBox txtValue = new TextBox(); txtValue.ID = "txtValue"; ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.