Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enabling Server Controls thru Client Side events

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
Hi,

I have a client side script on the onclick event of a server control button. The script should enable or disable a Calendar control.
Can this be done? Can a client side script enable or disable a server-side control?

Any help appreciated.

 
It sure can be done..
Say the name of your server control is "testcontrol", then the code will be like this..

document.getElementById("testcontrol").disabled = true;
 
Thank you very much.

I tried doing that, I am making a panel control visible which has a calendar and a button inside, it gives me an error
"document.getElementID("....) is null or not an object"

Any ideas why?

Thank you.
 
Is that a type mistake in the function...should be
"getElementById" ..not "getElementId"..

see if that works
 
Yes it is a typo.

I am now just trying to make a Calendar control show and hide using a client-side onclick event on a button.

Any ideas, please let me know.
Thank you.
 
You'd want to slap a JavaScript event on a control via Page.RegisterClientScriptBlock() and Control.Attributes.Add(). I can't help you on the specifics of JavaScript.
 
Thank you.

I tried doing that, but how do you refrence a Calendar control in the client script? The document.getElementById doesn't seem to work.

Maybe I am missing something, .Net should have something for this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top