Hi,
I have an aspx page where some controls are initially disabled by the
code-behind 'Page_Load' event. I want these controls to be dynamically
enabled when the user checks a checkbox. Because I don't want a post-back,
I added some javascript to do this
However, using client-side JS, I cannot enable any controls that have been
disabled by server-side code. If the control is initially enabled, I can
disable/enable it client-side.
I'm using the following JS:
document.getElementById("Recursive_chk").disabled = false;
Is this a known problem, or am I doing something wrong?
Thanks,
Stuart
Env: Windows 2003, VS. Net 2003, 1.1 Framework, IE 6+ 6 7725
Hi,
I dunno its a better way or not. but i suggest u to make the control disbale
on design time..
input id="cterdate" type="text" maxLength="12" size="20" name="cterdate"
runat="server" disabled
Now you can change the status of the field on page load event on the server
side or onthe client side. that will work ...
Regards
Ahmed
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message
news:#D**************@TK2MSFTNGP10.phx.gbl... Hi,
I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. Because I don't want a
post-back, I added some javascript to do this
However, using client-side JS, I cannot enable any controls that have been disabled by server-side code. If the control is initially enabled, I can disable/enable it client-side.
I'm using the following JS:
document.getElementById("Recursive_chk").disabled = false;
Is this a known problem, or am I doing something wrong?
Thanks, Stuart
Env: Windows 2003, VS. Net 2003, 1.1 Framework, IE 6+
Hi Ahmed,
Thanks for the reply.
Yes, that would work with HTML controls, but I'm trying to enable a disabled
ASP.Net server side control...and thats the problem...
e.g.
<asp:checkbox id="Recursive_chk" style="Z-INDEX: 118; LEFT: 48px; POSITION:
absolute; TOP: 488px" tabIndex="11" runat="server" CssClass="description"
Enabled="False" Text="Recursive">
That checkbox is disabled at design time/code behind, but I can't enable it
using client-side script. And I don't want to revert to using HTML
controls, as its a step backwards. :)
My only other thought is to move the logic for enabling/disabling controls
to the HTML page and have that invoked when the page loads on the client,
but that just sucks!!
Regards,
Stuart
"Ahmed Ali" <ah***@visualsoft-inc.com> wrote in message
news:ur*************@tk2msftngp13.phx.gbl...> Hi, I dunno its a better way or not. but i suggest u to make the control
disbale on design time.. input id="cterdate" type="text" maxLength="12" size="20" name="cterdate" runat="server" disabled
Now you can change the status of the field on page load event on the
server side or onthe client side. that will work ...
Regards
Ahmed
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message news:#D**************@TK2MSFTNGP10.phx.gbl... Hi,
I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be dynamically enabled when the user checks a checkbox. Because I don't want a post-back, I added some javascript to do this
However, using client-side JS, I cannot enable any controls that have
been disabled by server-side code. If the control is initially enabled, I
can disable/enable it client-side.
I'm using the following JS:
document.getElementById("Recursive_chk").disabled = false;
Is this a known problem, or am I doing something wrong?
Thanks, Stuart
Env: Windows 2003, VS. Net 2003, 1.1 Framework, IE 6+
Stu,
How does Recursive_chk render on the client? Could you show us the resulting
HTML?
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl... Hi Ahmed,
Thanks for the reply.
Yes, that would work with HTML controls, but I'm trying to enable a
disabled ASP.Net server side control...and thats the problem...
e.g. <asp:checkbox id="Recursive_chk" style="Z-INDEX: 118; LEFT: 48px;
POSITION: absolute; TOP: 488px" tabIndex="11" runat="server" CssClass="description" Enabled="False" Text="Recursive">
That checkbox is disabled at design time/code behind, but I can't enable
it using client-side script. And I don't want to revert to using HTML controls, as its a step backwards. :)
My only other thought is to move the logic for enabling/disabling controls to the HTML page and have that invoked when the page loads on the client, but that just sucks!!
Regards, Stuart "Ahmed Ali" <ah***@visualsoft-inc.com> wrote in message news:ur*************@tk2msftngp13.phx.gbl...> Hi, I dunno its a better way or not. but i suggest u to make the control
disbale on design time.. input id="cterdate" type="text" maxLength="12" size="20"
name="cterdate" runat="server" disabled
Now you can change the status of the field on page load event on the server side or onthe client side. that will work ...
Regards
Ahmed
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message news:#D**************@TK2MSFTNGP10.phx.gbl... Hi,
I have an aspx page where some controls are initially disabled by the code-behind 'Page_Load' event. I want these controls to be
dynamically enabled when the user checks a checkbox. Because I don't want a post-back, I added some javascript to do this
However, using client-side JS, I cannot enable any controls that have been disabled by server-side code. If the control is initially enabled, I can disable/enable it client-side.
I'm using the following JS:
document.getElementById("Recursive_chk").disabled = false;
Is this a known problem, or am I doing something wrong?
Thanks, Stuart
Env: Windows 2003, VS. Net 2003, 1.1 Framework, IE 6+
John, it renders as:
<span class="description" disabled="disabled" style="Z-INDEX: 117; LEFT:
48px; POSITION: absolute; TOP: 488px"><input id="Recursive_chk"
type="checkbox" name="Recursive_chk" disabled="disabled" tabindex="11"
/><label for="Recursive_chk">Recursive</label></span>
Hmm, is the span taking precedence over the checkbox? ASP.Net emits the
<span>
Cheers,
Stu
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:#7**************@tk2msftngp13.phx.gbl... Stu,
How does Recursive_chk render on the client? Could you show us the
resulting HTML? -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message news:Ox**************@tk2msftngp13.phx.gbl... Hi Ahmed,
Thanks for the reply.
Yes, that would work with HTML controls, but I'm trying to enable a disabled ASP.Net server side control...and thats the problem...
e.g. <asp:checkbox id="Recursive_chk" style="Z-INDEX: 118; LEFT: 48px; POSITION: absolute; TOP: 488px" tabIndex="11" runat="server"
CssClass="description" Enabled="False" Text="Recursive">
That checkbox is disabled at design time/code behind, but I can't enable it using client-side script. And I don't want to revert to using HTML controls, as its a step backwards. :)
My only other thought is to move the logic for enabling/disabling
controls to the HTML page and have that invoked when the page loads on the
client, but that just sucks!!
Regards, Stuart "Ahmed Ali" <ah***@visualsoft-inc.com> wrote in message news:ur*************@tk2msftngp13.phx.gbl...> Hi, I dunno its a better way or not. but i suggest u to make the control
disbale on design time.. input id="cterdate" type="text" maxLength="12" size="20" name="cterdate" runat="server" disabled
Now you can change the status of the field on page load event on the server side or onthe client side. that will work ...
Regards
Ahmed
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message news:#D**************@TK2MSFTNGP10.phx.gbl... > Hi, > > I have an aspx page where some controls are initially disabled by
the > code-behind 'Page_Load' event. I want these controls to be dynamically > enabled when the user checks a checkbox. Because I don't want a post-back, > I added some javascript to do this > > However, using client-side JS, I cannot enable any controls that
have been > disabled by server-side code. If the control is initially enabled,
I can > disable/enable it client-side. > > I'm using the following JS: > > document.getElementById("Recursive_chk").disabled = false; > > Is this a known problem, or am I doing something wrong? > > Thanks, > Stuart > > Env: Windows 2003, VS. Net 2003, 1.1 Framework, IE 6+ > >
Yes, said nail is now bent; it's the bloody <span>!
ASP.Net should not be setting the span to disabled, since it is completely
redundant - the checkbox renders itself disabled...<shakes head>...ASP.Net
is driving me nuts today! :)
Thanks for your help Jon!
Stu
"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:uT**************@TK2MSFTNGP10.phx.gbl... Stu,
You may have hit the nail on the head. As an experiment, try putting that code into your .aspx file as raw HTML (changing the name and id of the checkbox, of course). And see if your JavaScript can enable it. I bet if
you remove the disabled attribute from the span, it will work.
All of which _still_ leaves you in trouble, but at least you'll know what kind of trouble you're it! Your JavaScript code would have to use the DOM
to get to the parent of Recursive_chk to enable or disable it as well. -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message news:ud**************@tk2msftngp13.phx.gbl... John, it renders as:
<span class="description" disabled="disabled" style="Z-INDEX: 117; LEFT: 48px; POSITION: absolute; TOP: 488px"><input id="Recursive_chk" type="checkbox" name="Recursive_chk" disabled="disabled" tabindex="11" /><label for="Recursive_chk">Recursive</label></span>
Hmm, is the span taking precedence over the checkbox? ASP.Net emits the <span>
Cheers, Stu
"John Saunders" <jo***********@surfcontrol.com> wrote in message news:#7**************@tk2msftngp13.phx.gbl... Stu,
How does Recursive_chk render on the client? Could you show us the resulting HTML? -- John Saunders Internet Engineer jo***********@surfcontrol.com
"Stu Carter" <St********@somekindofcompany.co.uk> wrote in message news:Ox**************@tk2msftngp13.phx.gbl... > Hi Ahmed, > > Thanks for the reply. > > Yes, that would work with HTML controls, but I'm trying to enable a disabled > ASP.Net server side control...and thats the problem... > > e.g. > <asp:checkbox id="Recursive_chk" style="Z-INDEX: 118; LEFT: 48px; POSITION: > absolute; TOP: 488px" tabIndex="11" runat="server" CssClass="description" > Enabled="False" Text="Recursive"> > > That checkbox is disabled at design time/code behind, but I can't enable it > using client-side script. And I don't want to revert to using HTML > controls, as its a step backwards. :) > > My only other thought is to move the logic for enabling/disabling controls > to the HTML page and have that invoked when the page loads on the client, > but that just sucks!! > > Regards, > Stuart > > > > "Ahmed Ali" <ah***@visualsoft-inc.com> wrote in message > news:ur*************@tk2msftngp13.phx.gbl...> Hi, > > > > I dunno its a better way or not. but i suggest u to make the
control > disbale > > on design time.. > > input id="cterdate" type="text" maxLength="12" size="20" name="cterdate" > > runat="server" disabled > > > > Now you can change the status of the field on page load event on
the > server > > side or onthe client side. that will work ... > > > > Regards > > > > Ahmed > > > > "Stu Carter" <St********@somekindofcompany.co.uk> wrote in message > > news:#D**************@TK2MSFTNGP10.phx.gbl... > > > Hi, > > > > > > I have an aspx page where some controls are initially disabled
by the > > > code-behind 'Page_Load' event. I want these controls to be dynamically > > > enabled when the user checks a checkbox. Because I don't want a > > post-back, > > > I added some javascript to do this > > > > > > However, using client-side JS, I cannot enable any controls that have > been > > > disabled by server-side code. If the control is initially enabled, I > can > > > disable/enable it client-side. > > > > > > I'm using the following JS: > > > > > > document.getElementById("Recursive_chk").disabled = false; > > > > > > Is this a known problem, or am I doing something wrong? > > > > > > Thanks, > > > Stuart > > > > > > Env: Windows 2003, VS. Net 2003, 1.1 Framework, IE 6+ > > > > > > > > > > > >
I figured it out for ya. Had the same problem
use this
//To Disable
document.getElementById(strHiddenCheckBox).parentE lement.setAttribute('disabled','true');
//To Enable
document.getElementById(strHiddenCheckBox).parentE lement.removeAttribute('disabled'); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dune |
last post by:
Hi there,
If a control is disabled (enabled = false), will the validator controls associated with it automatically know not to carry out validation?
I have a page with a bunch of controls and...
|
by: ara99 |
last post by:
I'm sure I'm missing something simple -- when I create an .aspx file in .Net studio and try to add some web forms controls (runat server) - all the controls (label, textbox, etc.,) are disabled. How...
|
by: DC |
last post by:
Hi All,
When a control is disabled, it is grayed out.
Is there anyway to set a different foreground/background color for disabled
controls (combobox, textbox, etc).
Thanks.
DC
|
by: Ahmed |
last post by:
Hi all,
Is there a way to have controls such as combobox, textbox and buttons
respond to events while they are disabled?
I know that in textbox contorl there is a readonly option which isnot...
|
by: Chattanooga |
last post by:
hi all,
is there a way to enable all controls in a web form?
something like
for each control in page.controls
control.enabled = true
next
i tried the one above, but that did not give me...
| |
by: nileshkarkhanis |
last post by:
Hi!
Could any one suggest me how I can have tooltips for disabled controls?
Regards
Nilesh Karkhanis
|
by: Plack |
last post by:
Hello,
as I had the same problem as many others with the fixed back and fore
color of disabled controls I decided to implement my own controls
where exactly this behaviour is provided. I know that...
|
by: Meels Lilbok |
last post by:
Hi
i have following problem
1) I add checkbox controls dynamically to webpage
2) user has time limit to check those boxes
3) if time is over checkboxes are disabled and Submit button...
|
by: Dan Tallent |
last post by:
I have a scenerio when my forms are first opened that the user cannot modify
the data. The fields are disabled to prevent them from modifying any of the
data. If a user wishes to modify the...
|
by: sanndeb |
last post by:
I want to enable/disable controls of a asp.net page against a logged in user's permission. say 'admin' & 'hr' can change user's birth date text-box in a page but others will see the text-box as...
|
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: 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,...
|
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...
|
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...
|
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,...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |