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
425
Webdropdown SelectedIndexChanged JavaScript not working
posted

Hi All,

I'm having multi select webdropdowns and on selectedindexchanged event i need to add the VALUE fields to a string, But i'm not able to get the VALUE fields of webdropdown rather i'm getting the INDEX i,e if 1st and 5th items are selected in the dropdown i'm getting the values 1, 5..

I tried using get_currentValue() but it is throwing an error object of type  not supported.. Below is the script for that, Kindly look into this..

<code>

for (i = 0; i < newItems.length; i++)
    {
        if (sender._id == "cph1_ddlPC")
        {
            if (newItems[i].get_index() < 10)
            {
                newItemsString += "0" + newItems[i].get_currentValue() + ", ";
            }
            else
            {
                newItemsString += newItems[i].get_currentValue() + ", ";
            }
        }
        else
        {
            newItemsString += newItems[i].get_currentValue() + ", ";
        }
    }

</code>

Parents
No Data
Reply
  • 37874
    posted

    Hi pavanpuligandla,

    From the eventArgs of client-side SelectionChanged event handler you could get the array of selected items and their text or value, using the following syntax:

    function WebDropDown1_SelectionChanged(sender, eventArgs) {

        var text = eventArgs.getNewSelection()[0].get_text();

        var value = eventArgs.getNewSelection()[0].get_value();

    }

     

     

    Please let me know if this helps.

Children