Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Module
            <asp:Label ID="lbl_Name1" runat="server" ForeColor="Red" Text="*"></asp:Label>
            </td><td><asp:TextBox  ID="txtmodule" runat="server"  Width="193px" class="required" ></asp:TextBox></td></tr>

        Parameter Type
            <asp:Label ID="lbl_Name2" runat="server" ForeColor="Red" Text="*"></asp:Label>
            </td><td><asp:TextBox ID="txtparameterType" runat="server"
            Width="193px" class="required"></asp:TextBox></td></tr>
        <tr><td>

   Parameter Value
            <asp:Label ID="lbl_Name3" runat="server" ForeColor="Red" Text="*"></asp:Label>
            </td><td><asp:TextBox ID="txtparameterValue" runat="server" TextMode="MultiLine"
                class="required"></asp:TextBox></td></tr>
                <tr>


               parameters
                </td>
                <td>
                    <asp:DropDownList ID="ddl_parvalues" runat="server">
                        <asp:ListItem Value="">--select--</asp:ListItem>
                        <asp:ListItem Value="parameter1">value1</asp:ListItem>
                        <asp:ListItem Value="parameter2">value2</asp:ListItem>
                    </asp:DropDownList>
                </td>
                </tr>

                parametertype
                </td>
                <td>
                    <asp:DropDownList ID="ddl_parmtype" runat="server">
                        <asp:ListItem Value="">--select--</asp:ListItem>
                        <asp:ListItem Value="type1">ParamType1</asp:ListItem>
                        <asp:ListItem Value="type2">ParamType1</asp:ListItem>
                    </asp:DropDownList>
                </td>
                </tr>

here i am using 2 dropdownlist,but in my proj we are using more than 5 dropdownlist and even 
declare every dropdownlist id into jquery is littelbit tuf job,please help me




and this is jquery with class


<pre lang="xml">&lt;script type=&quot;text/javascript&quot;&gt;
       $(document).ready(function() {
       $(&#39;#&#39; + &#39;&lt;%= btnSave.ClientID %&gt;&#39;).click(function(e) {
               var isValid = true;
               $(&quot;&#39;input[type=&#39;text&#39;].required&#39;, &#39;input[type=&#39;textarea&#39;].required&#39;&quot;).each(function() {
                   if ($.trim($(this).val()) == &#39;&#39;) {
                       isValid = false;
                       $(this).css({
                           &quot;border&quot;: &quot;1px solid red&quot;,
//                           &quot;background&quot;: &quot;#FFCECE&quot;

                       });
                   }
                   else {
                       $(this).css({
                           &quot;border&quot;: &quot;&quot;,
                           &quot;background&quot;: &quot;&quot;
                       });
                   }
               });
               if (isValid == false)
                   e.preventDefault();
               else
                   alert(&#39;Thank you for submitting&#39;);
           });
       });

   &lt;/script&gt;</pre>

here i am going display red colour border line when user going to save button without fill any textbox and multiline textbox field,,but this jquery is working for textbox and multiline textbox but its not working when usernot select any value from dropdownlist so,,please help me
  How Get selected value of dropdownlist   in jquery,and here i am taking value of textbox and textarea, but i dont know how to get selected value of drop downlist in jquery
Posted
Updated 29-May-14 17:38pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900