Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Cascade WebDropDown from Textbox
posted

Hi,

I'm trying to get a webdropdown to load (without postback) from the value of a textbox. Is this possible? The user enters a number in the textbox and that number is used in a stored procedure to return a set for a dropdown. Right now I do this server-side with auto post backs.

I'm starting by adding the onchange event to the textbox:

textbox.Attributes.Add("onchange", "return textboxChanged(this);");

 

that calls this js function:

        function textboxChanged(textControl) {

            //Gets reference to the the webdropdown
            var webdropdown= $find('<%= webdropdown.ClientID %>');

            //clear current selection
            webdropdown.set_currentValue("", true);

            webdropdown.loadItems(textControl.value);
        }

 

but i don't think this is right. it doesn't pass the right objects to the webdropdown_ItemsRequested event. Can this approach work or do i need to go a different direction?

Thanks for any help you can provide.

Parents
No Data
Reply
  • 24671
    posted

    Hi,

    Do you mean that in the ItemsRequested server-side handler you have, the Value property doesn't contain the "textControl.value" you are setting?

    Could it be that textConrtrol.value doesn't refer to the correct text to filter by? 

    Thanks,

    Angel 

Children
No Data