By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

textbox loses values

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.