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

Fire up checkbox onclick event from asp.net codebehind

Hi!

I am working with asp.net 1.1 and javascript.

I have a client side checkbox, a client side button, and an asp.net
image button.

When I check the checkbox, I want the client side button to disable,
and I want the same button enebled if I uncheck the checkbox.

I have the checkbox_onclick javascript function needed to do that and
it is working fine.

The problem is that in the asp.net image button Click event (code
behind), I change programatically the checkbox value, depending on a
value queried from a database, and when this value is changed, it
doesn't fire up the checkbox javascript onclick handler, so, the
checkbox value changes, but not the disabled property of the client
side button. :'(

I would appreciate any help!

Thank you!

Sep 29 '06 #1
3 3192
I forgot to mention both client side checkbox and button controls have
the attribute: runat="server"

Thank you!

Sep 29 '06 #2
Is there a reason you can't disable the control from code-behind like
this?

if (dbValue == "whatever")
{
theControl.Enabled = false;
etc....
}

If that doesn't work for you, my other suggestion would be to create a
simple bit of javascript that runs on load. If a certain condition is
met you fire the script to configure the controls on the page to match
whatever you need.

function afunc()
{
if ( 1 == <%= runme %>)
callTheClickFunction();
}

runme would be a variable or property you would set from code-behind.
You will still need to do something similar in code-behind as I showed
you before but now you can let the javascript handle enabling/disabling
the appropriate controls.

Thats all I got for now. Hope this helps.

cc******@gmx.net wrote:
I forgot to mention both client side checkbox and button controls have
the attribute: runat="server"

Thank you!
Sep 29 '06 #3
Thank you Gozirra.

I made a mistake in my last post: the client side button which I want
to disable/enable programatically, must be precisely just client side
(it doesn't have runat="server" attribute like I said before), because
it makes some tasks related with digital signature with Capicom
library.

That's why I can't access its .Enabled property from aspx code-behind,
or at least I don't know how to do that without converting it to a
server control.

I will try the second approach.

Thank you very much!

Sep 29 '06 #4

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

Similar topics

3
by: F. Da Costa | last post by:
Hi, Does the following indeed imply that this event is NOT called when an <input type="checkbox" is toggled? This would thus imply the usage of the onClick handler instead (assuming an action...
2
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb"...
5
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
1
by: Nacho | last post by:
Hello all I have a hidden checkbox with an "onclick" event. I can not physically perform this event (obviously) because the checkbox is hidden. I would like to simulate the onclick event from...
3
by: ccordero | last post by:
Hi! I am working with asp.net 1.1 and javascript. I have a client side checkbox, a client side button, and an asp.net image button. When I check the checkbox, I want the client side button...
3
by: John Kotuby | last post by:
Hi all... I am trying to do a simple thing and maybe am missing something elementary. I have created a Javascript function at the top of a page which is meant to enable editing of an HTML input...
3
by: | last post by:
Hi all, I have a CheckBoxList control which has about 10 items. I have set autopostback=true and also set an eventhandler for OnSelectedIndexChanged. The problem is I want to identify which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...
0
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...
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...
0
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...
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,...

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.