Trying to write a page with several controls on it, some of which, depending
on the process login, are enabled and some disabled. When I click on a save
button to cause a postback event to fire, the controls that are not enabled
don't have their data returned, so in the UpdateClick event, the controls
contain nothing.
How do I get it to maintain the state even for these columns ?
thanks
Adrian 5 1250
the browser does not postback values for disabled fields. you will need
client script to copy the values to a hidden field. if you disable them in
the code behind, save their disabled value in viewstate, then restore it on
postback.
-- bruce (sqlwork.com)
"Adrian Parker" <ap******@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... Trying to write a page with several controls on it, some of which, depending on the process login, are enabled and some disabled. When I click on a save button to cause a postback event to fire, the controls that are not enabled don't have their data returned, so in the UpdateClick event, the controls contain nothing.
How do I get it to maintain the state even for these columns ?
thanks Adrian
Is there any easier way of not allowing entry of fields apart from setting
enabled to false ?
"Bruce Barker" <br******************@safeco.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl... the browser does not postback values for disabled fields. you will need client script to copy the values to a hidden field. if you disable them in the code behind, save their disabled value in viewstate, then restore it on postback.
-- bruce (sqlwork.com) "Adrian Parker" <ap******@nospam.nospam> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... Trying to write a page with several controls on it, some of which, depending on the process login, are enabled and some disabled. When I click on a save button to cause a postback event to fire, the controls that are not enabled don't have their data returned, so in the UpdateClick event, the controls contain nothing.
How do I get it to maintain the state even for these columns ?
thanks Adrian
Hi Adrian,
I think Bruce's suggestions are reasonable since disabled html input fields
won't post back their values. And there hasn't any better means other than
copy and store the values into other place(viewstate or sessionstaet)
before disabling the entry fields.
BTW, is it possbile that we don't disable them? For some control such as
TextBox( <input type=text ... ), we can set it's "readonly" attribute. For
example:
txtName.Attributes["readonly"] = "true";
the above statement make the txtName (a textbox control) readonly( can't
change its text), but its value can still be posted back to server side.
In addition, we can also consider settting those control's Visible to false
so as to hidden them.
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Ok thanks guys, I'll give that a go.
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Cc**************@TK2MSFTNGXA01.phx.gbl... Hi Adrian,
I think Bruce's suggestions are reasonable since disabled html input fields won't post back their values. And there hasn't any better means other than copy and store the values into other place(viewstate or sessionstaet) before disabling the entry fields.
BTW, is it possbile that we don't disable them? For some control such as TextBox( <input type=text ... ), we can set it's "readonly" attribute. For example:
txtName.Attributes["readonly"] = "true";
the above statement make the txtName (a textbox control) readonly( can't change its text), but its value can still be posted back to server side. In addition, we can also consider settting those control's Visible to false so as to hidden them.
Hope helps. Thanks,
Steven Cheng Microsoft Online Support
Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
OK. If there are any further questions or anything else we can help, please
always feel free to post here.
Good Luck! :-)
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Kirksey |
last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
|
by: dm_dal |
last post by:
Is there a know issue surrounding the CheckBoxList control and it's
viewstate?
When my control is created, it's ListItems are checked as needed, but on a
postback, they loose their Selected...
|
by: Chuck Ritzke |
last post by:
Hi,
I've searched the newsgroup and other sources to understand how to handle
runtime controls and see I'm not the only one who's confused, but I'm still
not quite sure of the best way to handle...
|
by: Christophe Peillet |
last post by:
I have a CompositeControl with two types of properties:
1.) Mapped Properties that map directly to a child control's properties
(ex.: this.TextboxText = m_txt.Text). These properties are handled...
|
by: Nick C |
last post by:
Hi
How can i reduce the viewstate for my asp.net application. It is getting
very large now. What is a good solution?
thanks
N
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |