You must Sign In to post a response.
  • Category: Silverlight

    Combo box validation in silverlight


    I have 3 combo box's and 1 textbox and submit button.

    I need to write validation on clikcing submit button,if any one of the 3 combo box value is not selected and textbox value is not entered then alert message should come.

    Any code or link plz.

  • #753937
    You can validate the same using the JQuery code.

    if($('.dropDownName > option[value!=""]').length == 0) {

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #753946

    Check the code,same code u can use for Silverlight also.

    var value = $('#combobox').val();
    if (value == -1)
    alert('select combo value');
    return false;
    return true;


    Note: "BtnSubmit" is the id of Submit buttom and "City" is the id of Combobox

    and use code behind like this:
    <select name="title" id="combobox">
    <option value="0">Select one...</option>
    <option value="-1">Select one...</option></select>

    Note: you can give index 0 or -1 to the select option of combo box

    hope its helpful for you..


  • Sign In to post your comments