JScript - ASP Wizard Control [modified]
-
I'm a app developer moving into the world of web development so forgive me if this is a stupid question. Is it possible to access a control contained inside an ASP Wizard control in Java Script? I'd rather handle something simple like this on the client side rather than waste server time activating a text box For example: I have a combo box and if the user selects 'other', I want a text box to be enabled. Here's a sample of my script code if(document.getElementById("ddSampleLookup").outerHTML == "Other") {blah blah blah} When my onclose handler for the drop down hits, I get the following error: Microsoft JScript runtime error: Object required I've tried with quotes, without quotes and even with single quotes but still no love. I should mention that when I try without quotes I get the error: "Microsoft JScript runtime error: 'txtNarcoticName' is undefined" instead. Thanks in advance! Edit: I should not that I put this here rather than the Web Development forum because I wasn't sure if this was a Java Script issue or an issue with the wizard control. -- modified at 14:22 Monday 29th January, 2007
-
I'm a app developer moving into the world of web development so forgive me if this is a stupid question. Is it possible to access a control contained inside an ASP Wizard control in Java Script? I'd rather handle something simple like this on the client side rather than waste server time activating a text box For example: I have a combo box and if the user selects 'other', I want a text box to be enabled. Here's a sample of my script code if(document.getElementById("ddSampleLookup").outerHTML == "Other") {blah blah blah} When my onclose handler for the drop down hits, I get the following error: Microsoft JScript runtime error: Object required I've tried with quotes, without quotes and even with single quotes but still no love. I should mention that when I try without quotes I get the error: "Microsoft JScript runtime error: 'txtNarcoticName' is undefined" instead. Thanks in advance! Edit: I should not that I put this here rather than the Web Development forum because I wasn't sure if this was a Java Script issue or an issue with the wizard control. -- modified at 14:22 Monday 29th January, 2007
The issue is that your client controls all have names created by ASP.NET. So, you need to insert this script with RegisterClientScriptBlock, and do something like: "if(document.getElementById("" + ddSampleLookup.ClientID + "").outerHTML == "Other")" ( not corrected for quotes The other option is this: if(document.getElementById("<%ddSampleLookup.ClientID%>").outerHTML == "Other") which can go in your aspx, the <% %> block is server side code. You should also always check that document.getElementById has returned you something, or you will risk this sort of error.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert