Hello,

I am new to this and have run into a small problem. I am using the Ajax toolkit with VS 2005 to fill some drop downs through a web service and it works great. All of the cascading drop downs work correctly. The only problem I have is I need to copy the drop downs value from each cascading drop down into a hidden drop down. I have struggled with this for a few days now so if anyone could offer me some advice I would really appreciate it.

Thanks

Recommended Answers

All 2 Replies

hi
with each ajax request when you are filling your dropdown you also create hidden value node using dom apis.
use api
-document.creatElement('tag_name');
to create tag
-document.getElementById('idofparent');
to get parent element where hidden will reside
-parent.appendChild(child_node);
to add child hidden node to parent.

Thanks for the reply but if you have the chance I could use some clarification about what you mean. I will also explain better what it is I am trying to do.

The ajax cascading drop downs work great. But I a, using a third party plug in that generates the html for the page. The original drop downs generated by the third party are not ajaxed so in the code behind I hide them all and replace them with new ajax drop downs. This works so far.

Now the problem I have is the third party checks to see if the original drop downs have been selected before you can save. and if not send an alert box saying you didnt fill them out. So what i need to do is when you select anything from the new ajax drop downs I need to set the now hidden original drop downs to the same value.

What I am trying to do, and i have no idea if it will work is register some javascript that does the work. But when I try and add the attribute of onClick to the ajax drop down it never shows up in the html:

MyDropDownList .Category = "First";
            MyDropDownList .ServiceMethod = "FirstDropDownList";
            MyDropDownList .ServicePath = "CascadeDropDown.asmx";
            MyDropDownList .PromptText = "Please Work...";

       this.MyDropDownList .Attributes.Add("onchange", "doSomething();");

the registered javascript function doSomething does show up in the generated html.

Thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.