1

I am using Telerik Dropdownlist in ASP.NET MVC3.

I have take placeholder in it as Select.

After selecting value when i'll click on reset button, I want to set dropdownlist's selected value as a value of placeholder.

Want to do this in a jquery.

I tried many options like this:

  1.   $("#DropDown1").val($("DropDown1 option:first").val());

  2.   $("#DropDown1 option:first").attr('selected', 'selected');

  3.   $("#DropDown1").val("Select");

  4.   $("#DropDown1")[0].selectedIndex = 0;

  5.   $("#DropDown1").selectmenu("refresh");

But none of these are working. My dropdownlist is in a .ascx view like:

<%= Html.Telerik().DropDownList().Placeholder("Select").Name("DropDown1").BindTo(new SelectList((IEnumerable)ViewData["DropDown1"], "Value", "Text", true))%>

I am fetching the list in a dropdownlist from ViewData and I have took Select as a placeholder

Want some suggestions....

2 Answers 2

2

Not sure if I understood your question correctly, but using standard HTML only this will make the selected item be "Select" on a reset:

<form>
    <select>
        <option value="option1" disabled selected>Select</option>
        <option value="option2">Option 2</option>
        <option value="option3">Option 3</option>
    </select>
    <input type="reset" />
    <input type="submit" />
</form>
2
  • Sir, am using the telerik dropdownlist for a getting result on the basis of selected item.and using this dropdownlist in a .aspx view. am adding my dropdown in question so that u can understand it Jun 13, 2013 at 5:07
  • Sorry, I haven't used this control. It also seems like Telerik have updated it: docs.kendoui.com/api/web/combobox#configuration-placeholder. The link is to the ComboBox. I Couldn't find placeholder for the dropdown.
    – Ciniod
    Jun 13, 2013 at 12:08
0

I resolved my question on my own:

I used this function:

function setValue() {
    var DropDownList = $("#DropDown1").data("tDropDownList");
    DropDownList.select(0);
    return false;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.