I need some help

G

Guest

I have a web application built in .NET Framework 1.1. The application has
alot of content so I need to avoid postback at all costs.

The application has a javascript file which handles disabling and enabling
controls based on specific values of other controls.

I also have alot of ASP.NET validation controls which are executed when you
click the submit button.

My problem is that in the ASP.NET validations I need to know if that control
is currently disabled or enabled to know which type of validation to perform.

I have researched this problem and have seen peoples solutions by using
document.getElementById("control").setAttribute("disabled","true") to mimic
the way .NET handles the enabled property. But I have had no luck attempting
it using this way. I also placed span tags around my controls and used
document.getElementById("control").parentElement.setAttribute("disabled","true") but still no luck.

I have a last resort of having tons of hidden textboxes that I can
read/write through javascript or .NET to tell what the status is but this is
a ugly solution which I would like to avoid.

If javascript appends disabled as an attribute to the input control why cant
..NET be aware of that change in the controls attributes properties?

--
Regards,
Shaun Goldston

Liberalism is treason!
Vote Republican
 
G

Guest

No. It's the server-side validation controls that I am using, and within them
I need access to see if javascript has disabled the control.
--
Regards,
Shaun Goldston

Liberalism is treason!
Vote Republican
 
P

Paul Henderson

No. It's the server-side validation controls that I am using, and within them
I need access to see if javascript has disabled the control.

When the page is posted back, only actual values of controls will be
sent; the properties of DOM objects [i.e. whether they are
enabled/etc.] are not posted by the browser, and you must use a
separate mechanism to ensure that the server gets this data if it needs
it.

You could probably have the client-side code construct a single string
the contains an indication of whether each control is enabled, and then
just post that back with the request and inspect it on the server side.
That would only require a relatively small amount of data to be
transferred, and would not slow down either the client or the server
massively [if it does, you perhaps need to consider splitting your form
up into smaller bits!]

-- PH

Ray Booysen said:
Are you speaking about the client side scripts of the ASP.NET validators?

A_Republican said:
I have a web application built in .NET Framework 1.1. The application has
alot of content so I need to avoid postback at all costs.

The application has a javascript file which handles disabling and enabling
controls based on specific values of other controls.

I also have alot of ASP.NET validation controls which are executed when you
click the submit button.

My problem is that in the ASP.NET validations I need to know if that control
is currently disabled or enabled to know which type of validation to perform.
[snip]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top