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

Repost : Protecting a textbox from input

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
2 1084
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: andrewcw | last post by:
I have 2 frames - one with button and another with a grid How do I get a reference to the controls on the other webform ? From the one frame I can 'see the webform' fo the other frame, bit not...
0
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows...
2
by: Alex Shirley | last post by:
HI I'm trying to iterate through all the textboxes on a webpage and trim them for spaces. i.e. If a user enters " hello world " we correct it to "hello world" So far I've come up with...
9
by: Darrel | last post by:
I'm learning a bit about the SWL injection issues and want to write a shared class that I can call from anywhere in my project to 'sanitize' any incoming text from textfields before sending to the...
0
by: Ken Powers | last post by:
Hello everyone, Sorry about the repost, my second VB.NET App is done with the exception of this error. I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! ...
8
by: Peter Proost | last post by:
Hi, this is my (simplified) situation: I have got 3 forms and one usercontrol: their names are: container (startup object),myform,another, mycontrol contair has got IsMdiContainer set to...
2
by: Pipo | last post by:
Nobody knows how to get the values provided in the client can be read in the user-control? If have made a Web Custom Control with 2 textboxes and 1 dropdownlist. The user fills in my control (the...
1
by: D-Someone | last post by:
I am re-posting this message as originially it did not get a single response.. Any ideas? -------------- I am trying to come up with a good design for a web service that has some user logic...
1
by: rakeshnair | last post by:
i wrote a code in jsp to create dynamic table..the problem is i need data base connection when cursor moves from one cell to other... eg...when i enter product id in the first cell, the product name...
1
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.