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

    DropDownList Validation not working inside Gridview

    I have a dropdownlist inside a gridview,the drop list should populate from database and default value should be SELECT.

    when i Click Save button it should check all the dropdownlist values. If any one is still SELECT it should prompt error select any values.
    When i normaly check without inside gridview it works fine and not inside gridview.

    I have attached my codings below.

    Help in this regard.

    Thanks
  • #768128
    Hi Syed,

    What I understand is, without grid value it is prompting error message and with the grid data value even it was in Select it is not working? Because I don't find the attachment of the coding.

    I feel like when datagrid is loaded. It is taking the first value of the loaded grid.
    we can perform two ways to find this.

    #Pass the Select string along with the Datagrid values I mean pass it from the Backend instead of hardcoding in front end.

    #To understand what is happening give a alert message with the values of that text box.. check whether you are really get the "Select" string when the data grid is loaded.

    Thanks,
    Mani

  • #768156
    hi Syed,

    are you using Required Field Validator or something else ...? .

    then if you add your query it would be useful to us for give you much better answer

    Prayer through, Impossible becomes HimPossible
    Paul.S

  • #768158
    Hi Syed,

    Did you give proper validation?
    Have a javascriptvalidation function and call it, Refer the below.. It may give you an idea

    <script type="text/javascript">
    function gridviewDropdownValidations() {
    var temp= true;
    var gridviewDrpdowns = new Array();
    var gridview = document.getElementById('<%=gridview.ClientID %>');
    for (var x = 0; i < dropdowns.length; x++) {
    if (gridviewDrpdowns .item(i).value == '0') //loop through each dropdown to check the selected value
    {
    temp= false;
    break;
    }
    }
    if (!temp) {
    alert('Give your alert message');
    }
    return temp;
    }
    </script>

    Regards,
    SonyShiva
    Never lose hope..You never know what tomorrow will bring


  • Sign In to post your comments