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

Repost : Protecting a textbox from input

P: n/a
Hi all,

I have a gridview with bound controls and some column templates. One of
these column templates is a textbox which is used for running totals. I
don't want the user to edit this so I merely set the enabled property to
false. The problem I'm having is that when the page posts back to the server
then back to the client again, the viewstate is gone and it's initialazed to
0.

How can I keep the viewstate and yet prevent the user from editing the
values client-side?

Regards
John.


Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
First, you could just make is a label rather then a textbox.

Second, you need to ensure that the control gets recreated sometime during
the Init event because the viewstate loads sometime between the Init and
Load.

"John" <a@b.com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I have a gridview with bound controls and some column templates. One of
these column templates is a textbox which is used for running totals. I
don't want the user to edit this so I merely set the enabled property to
false. The problem I'm having is that when the page posts back to the
server
then back to the client again, the viewstate is gone and it's initialazed
to
0.

How can I keep the viewstate and yet prevent the user from editing the
values client-side?

Regards
John.

Nov 19 '05 #2

P: n/a
have you tried using the clientside onfocus event, you could probably
setfocus to another screen area should the texbox recieve focus whihc should
still allow the value to be updated. Alternatively, you could always use a
label.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"John" <a@b.com> wrote in message
news:u1**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I have a gridview with bound controls and some column templates. One of
these column templates is a textbox which is used for running totals. I
don't want the user to edit this so I merely set the enabled property to
false. The problem I'm having is that when the page posts back to the
server
then back to the client again, the viewstate is gone and it's initialazed
to
0.

How can I keep the viewstate and yet prevent the user from editing the
values client-side?

Regards
John.

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.