473,396 Members | 2,013 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.

asp.net 2.0 disabled=true problems

Hey,
I'm working with asp.net 2.0.
I make objects (like ddl, textbox...) disabled=true in client side. Then,
when I get to the server in post action, these objects lose their value.
For example: ddl comes back after postback with the first values in it's
list - it doesn't keep the new value that the user chooses,
and textbox - still remains it's last value, like the user didn't alter it.
What I'm trying to say is that making object on client side disabled, harm
their value later on server side.
I thought maybe it is something in asp.net 2.0.
If someone knows something about it, I'll be glad to hear some advices.
Thanks a lot anyways!
Sep 10 '06 #1
3 1844
On Sun, 10 Sep 2006 02:08:01 -0700, moshi <mo***@discussions.microsoft.com>
wrote:
>Hey,
I'm working with asp.net 2.0.
I make objects (like ddl, textbox...) disabled=true in client side. Then,
when I get to the server in post action, these objects lose their value.
For example: ddl comes back after postback with the first values in it's
list - it doesn't keep the new value that the user chooses,
and textbox - still remains it's last value, like the user didn't alter it.
What I'm trying to say is that making object on client side disabled, harm
their value later on server side.
I thought maybe it is something in asp.net 2.0.
If someone knows something about it, I'll be glad to hear some advices.
Thanks a lot anyways!
To make values survive postbacks you need to store them in ViewState Property of
the Page.

Example:

// before Postback:

int counter;
num = 1;
ViewState["num"] = 1;

// After the postback retrieve the value of counter:

if(ViewState["num"] != null)
{
num = (int)ViewState["num"];
}
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Sep 10 '06 #2
On Sun, 10 Sep 2006 13:27:14 -0500, Otis Mukinfus <ph***@emailaddress.com>
wrote:
>On Sun, 10 Sep 2006 02:08:01 -0700, moshi <mo***@discussions.microsoft.com>
wrote:
>>Hey,
I'm working with asp.net 2.0.
I make objects (like ddl, textbox...) disabled=true in client side. Then,
when I get to the server in post action, these objects lose their value.
For example: ddl comes back after postback with the first values in it's
list - it doesn't keep the new value that the user chooses,
and textbox - still remains it's last value, like the user didn't alter it.
What I'm trying to say is that making object on client side disabled, harm
their value later on server side.
I thought maybe it is something in asp.net 2.0.
If someone knows something about it, I'll be glad to hear some advices.
Thanks a lot anyways!

To make values survive postbacks you need to store them in ViewState Property of
the Page.

Example:

// before Postback:

int counter;
num = 1;
ViewState["num"] = 1;

// After the postback retrieve the value of counter:

if(ViewState["num"] != null)
{
num = (int)ViewState["num"];
}
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
OOPS!

That should be...

int num;
num = 1;
ViewState["num"] = 1;

// After the postback retrieve the value of counter:

if(ViewState["num"] != null)
{
num = (int)ViewState["num"];
}

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Sep 10 '06 #3
Hi there,
thanks for your assistance.
I think I wasn't clear - the problem I describe is that the user alters the
value of the ddl or text on client side, and then the field becomes disabled
and post to the server. in the server side it arrives with defect values -
the text box arrives with it's former value and the ddl with it's first value
in the list.
Hope that you'll have any idea,Thanks a lot.
btw - these filelds have enableviewstate=true

"Otis Mukinfus" wrote:
On Sun, 10 Sep 2006 13:27:14 -0500, Otis Mukinfus <ph***@emailaddress.com>
wrote:
On Sun, 10 Sep 2006 02:08:01 -0700, moshi <mo***@discussions.microsoft.com>
wrote:
>Hey,
I'm working with asp.net 2.0.
I make objects (like ddl, textbox...) disabled=true in client side. Then,
when I get to the server in post action, these objects lose their value.
For example: ddl comes back after postback with the first values in it's
list - it doesn't keep the new value that the user chooses,
and textbox - still remains it's last value, like the user didn't alter it.
What I'm trying to say is that making object on client side disabled, harm
their value later on server side.
I thought maybe it is something in asp.net 2.0.
If someone knows something about it, I'll be glad to hear some advices.
Thanks a lot anyways!
To make values survive postbacks you need to store them in ViewState Property of
the Page.

Example:

// before Postback:

int counter;
num = 1;
ViewState["num"] = 1;

// After the postback retrieve the value of counter:

if(ViewState["num"] != null)
{
num = (int)ViewState["num"];
}
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
OOPS!

That should be...

int num;
num = 1;
ViewState["num"] = 1;

// After the postback retrieve the value of counter:

if(ViewState["num"] != null)
{
num = (int)ViewState["num"];
}

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Sep 11 '06 #4

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

Similar topics

1
by: David Wake | last post by:
I have two radio buttons and two checkboxes in a form. I'm trying to write some code so that when a radio button is selected, its corresponding checkbox is disabled. My code looks like this: ...
2
by: CES | last post by:
All, I'm at a loss, the code below works in IE but not in Netscape and I'm unskilled enough not to know why. Essentially this code looks thru all of the form fields and if the input box has a...
6
by: JSjones | last post by:
Hi all, I'm new to these boards and my javascript experience is fairly limited and basic so please bear with me. Anyway, on to the question and some background. I'm developing using ColdFusion...
1
by: Martin | last post by:
Is disabled to be set in the style of a tag just like visible? I am trying to set the whole content of a td tag to disabled like this, style='disabled:true' and it does not seem to work. Is this...
1
by: Bin Song, MCP | last post by:
Hi all I got a strange problem In my webform, I have a server-side Button "btnDisable" to save some data and enable or disable all other fields in this form based on the data. The logic is: on...
6
by: tshad | last post by:
I am trying to disable and enable a checkbox from javascript. The problem is that if the checkbox starts out as: <input id="Override" type="checkbox" name="Override"/> I can change it back...
3
by: BrendanMcPherson | last post by:
How can I get a listbox to change a textbox on some selections. I have a listbox which only needs to be filled in on some selections. Is there a way I can have on some selections the textbox go...
4
by: kiransasi | last post by:
hi all, i m herewith struck with this problem.... check out the following code and lemme know the solution for this.... <html> <heAD> <TITLE>WAIT</TITLE>
2
by: CreativeMind | last post by:
hi i have following code but problem is that when i debug both checkboxes have disabled property always false whether it is checked or unchecked..thx for help. function checkFinance(){ var...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.