473,396 Members | 1,938 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,396 software developers and data experts.

textbox loses values

This one has got me absolutely stumped.

At work I have created a simple web form that gets data from a sql backend
and puts this to a dataset.
I have an edit button that when clicked will set the relevant text
properties of several textboxes (to allow for edit)
....all simple so far.
I have a save button that when clicked will then perform the writing back of
the text in the textboxes.
The problem is (and having debugged I see this) that upon entry to the save
button's event handler, the textbox.text properties suddenly become "".
(Before the click handler is entered the values are fine)

These are web controls and SHOULD retain their state.

I've created a very simple form at home a it values are retained on click
....any suggestions are gratefully receieved!

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address will
be changed!
Nov 19 '05 #1
4 1765
are you rebinding on postback?

if you are rebinding the values are being preserved but you are overwriting
them....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mark Broadbent" <no****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
This one has got me absolutely stumped.

At work I have created a simple web form that gets data from a sql backend
and puts this to a dataset.
I have an edit button that when clicked will set the relevant text
properties of several textboxes (to allow for edit)
...all simple so far.
I have a save button that when clicked will then perform the writing back of the text in the textboxes.
The problem is (and having debugged I see this) that upon entry to the save button's event handler, the textbox.text properties suddenly become "".
(Before the click handler is entered the values are fine)

These are web controls and SHOULD retain their state.

I've created a very simple form at home a it values are retained on click
...any suggestions are gratefully receieved!

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address will be changed!

Nov 19 '05 #2
Hi Karl. I am not using databinding at all. Im simply copying values to
textboxes on Edit click and copying values from textboxes on Save click
(however on the save click the values have disappeared!).

I know this setup is maybe not the most efficient but it is just a simple
form and I dont want to spend too long on it. (plus I'm dynamically building
up a radiobutton list from the record set so just trying to keep things
simple).

I just cannot see why those values disappear. They are there
pre-click.....and gone the second the click event handler is entered.

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address will
be changed!
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OD****************@TK2MSFTNGP09.phx.gbl...
are you rebinding on postback?

if you are rebinding the values are being preserved but you are
overwriting
them....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mark Broadbent" <no****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
This one has got me absolutely stumped.

At work I have created a simple web form that gets data from a sql
backend
and puts this to a dataset.
I have an edit button that when clicked will set the relevant text
properties of several textboxes (to allow for edit)
...all simple so far.
I have a save button that when clicked will then perform the writing back

of
the text in the textboxes.
The problem is (and having debugged I see this) that upon entry to the

save
button's event handler, the textbox.text properties suddenly become "".
(Before the click handler is entered the values are fine)

These are web controls and SHOULD retain their state.

I've created a very simple form at home a it values are retained on click
...any suggestions are gratefully receieved!

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address

will
be changed!


Nov 19 '05 #3
Mark,
Thanks for clearing up how your code worked. If I could ask you one
question. Do the textboxes exist when the page is initially loaded, or are
they dynamically added when the edit button is clicked? If they are
dynamically created, than the likeliess problem is that you need to recreate
them when the save button is clicked. If they aren't, then is it possible
that in page_Load you are initializign the textboxes to be blank ?

If I'm wrong on both counts, please provide code.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mark Broadbent" <no****@nospam.com> wrote in message
news:uY****************@TK2MSFTNGP12.phx.gbl...
Hi Karl. I am not using databinding at all. Im simply copying values to
textboxes on Edit click and copying values from textboxes on Save click
(however on the save click the values have disappeared!).

I know this setup is maybe not the most efficient but it is just a simple
form and I dont want to spend too long on it. (plus I'm dynamically building up a radiobutton list from the record set so just trying to keep things
simple).

I just cannot see why those values disappear. They are there
pre-click.....and gone the second the click event handler is entered.

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address will be changed!
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OD****************@TK2MSFTNGP09.phx.gbl...
are you rebinding on postback?

if you are rebinding the values are being preserved but you are
overwriting
them....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mark Broadbent" <no****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
This one has got me absolutely stumped.

At work I have created a simple web form that gets data from a sql
backend
and puts this to a dataset.
I have an edit button that when clicked will set the relevant text
properties of several textboxes (to allow for edit)
...all simple so far.
I have a save button that when clicked will then perform the writing back
of
the text in the textboxes.
The problem is (and having debugged I see this) that upon entry to the

save
button's event handler, the textbox.text properties suddenly become "".
(Before the click handler is entered the values are fine)

These are web controls and SHOULD retain their state.

I've created a very simple form at home a it values are retained on

click ...any suggestions are gratefully receieved!

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address

will
be changed!



Nov 19 '05 #4
Thanks for your helpful hints. It has lead me to re-think and look at my
page load event again (as you mentioned).
I feel like a bit off an idiot now because I realise I had a bit of code in
there (embedded in a proc) to initialize those textboxes.....and of course
this was getting called on every postback (which I wanted with exception of
those clear statements. I've refactored the code now so it all works like I
would expect.

Thanks for your help I needed that nudge in the right direction (even though
I initially thought 'no of course I'm not doing that!')

Br,

Mark.

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uM****************@TK2MSFTNGP10.phx.gbl...
Mark,
Thanks for clearing up how your code worked. If I could ask you one
question. Do the textboxes exist when the page is initially loaded, or
are
they dynamically added when the edit button is clicked? If they are
dynamically created, than the likeliess problem is that you need to
recreate
them when the save button is clicked. If they aren't, then is it possible
that in page_Load you are initializign the textboxes to be blank ?

If I'm wrong on both counts, please provide code.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Mark Broadbent" <no****@nospam.com> wrote in message
news:uY****************@TK2MSFTNGP12.phx.gbl...
Hi Karl. I am not using databinding at all. Im simply copying values to
textboxes on Edit click and copying values from textboxes on Save click
(however on the save click the values have disappeared!).

I know this setup is maybe not the most efficient but it is just a simple
form and I dont want to spend too long on it. (plus I'm dynamically

building
up a radiobutton list from the record set so just trying to keep things
simple).

I just cannot see why those values disappear. They are there
pre-click.....and gone the second the click event handler is entered.

--
Best Regards,

Mark

Mark Broadbent

mcad,mcdba,mcse+i
emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
remove AT with '@' and DOT with '.' -please do not send spam or address

will
be changed!
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OD****************@TK2MSFTNGP09.phx.gbl...
> are you rebinding on postback?
>
> if you are rebinding the values are being preserved but you are
> overwriting
> them....
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Mark Broadbent" <no****@nospam.com> wrote in message
> news:%2******************@TK2MSFTNGP11.phx.gbl...
>> This one has got me absolutely stumped.
>>
>> At work I have created a simple web form that gets data from a sql
>> backend
>> and puts this to a dataset.
>> I have an edit button that when clicked will set the relevant text
>> properties of several textboxes (to allow for edit)
>> ...all simple so far.
>> I have a save button that when clicked will then perform the writing back > of
>> the text in the textboxes.
>> The problem is (and having debugged I see this) that upon entry to the
> save
>> button's event handler, the textbox.text properties suddenly become
>> "".
>> (Before the click handler is entered the values are fine)
>>
>> These are web controls and SHOULD retain their state.
>>
>> I've created a very simple form at home a it values are retained on click >> ...any suggestions are gratefully receieved!
>>
>> --
>> Best Regards,
>>
>> Mark
>>
>> Mark Broadbent
>>
>> mcad,mcdba,mcse+i
>> emailto: newsgroupsATmettayyaDOTgotadslDOTcoDOTuk
>> remove AT with '@' and DOT with '.' -please do not send spam or
>> address
> will
>> be changed!
>>
>>
>
>




Nov 19 '05 #5

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

Similar topics

2
by: anonieko | last post by:
This applies to javascript dynamic textbox onkey > > > Newsgroups: comp.lang.javascript From: Lasse Reichstein Nielsen <l...@hotpop.com> - Find messages by this author Date: Fri, 15 Jul 2005...
0
by: Jonas L | last post by:
Hi, I need to create a textbox which acts as a normal textbox but with the following extra requirements: 1) In-focus color, when the textbox gets focus the backcolor property of the textbox...
3
by: Gidi | last post by:
Hi, Is it possible to know when TextBox loses focus to which object it lost it? what i mean is when the LostFocus Event occur is it possible to know which object got the focus instead? thanks,
5
by: PD | last post by:
The TextChanged event is not being called when I hit the "Enter" key. Yet it does for the "Tab" key. I set a break point in the Page_Load event and the TextChanged event and none of these get...
3
by: Pieter | last post by:
Hi, I'm making an Outlook (2003) Add-In (VB.NET 2005), with a simple button and a textbox (msoControlEdit). When the user types something in the textbox, and clicks on the button, the text in...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
8
by: Bhagya | last post by:
I am doing client side validation in my page. The password field does not retain its value. Pls help
3
by: S Moran | last post by:
private void button1_Click(object sender, EventArgs e) { textBox1.SelectionStart = 0; textBox1.SelectionLength = textBox1.Text.Length; } yet when the button is clicked and there is text in...
8
by: Marco Pais | last post by:
Hi there. How can I change the background color of a textbox when it gets the focus? I can handle the "Enter" event and do this private void txtDummie_Enter(object sender, EventArgs e) { ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.