how to client side validation for a text box using jscript in .net
<p>How can we write client side validation for a text box.
 for example:
If  we have a login page then how to write the validation function to check the required field.</p>

<p>I have designed an application using master page. in this i am not getting script in the source page when i tried to write the code. I am getting error that only content controls are allowed means what. how to proceed i don't understood. </p>

<p>Design of login page :</p>



<p></p>

<pre><code>&lt;div id="contenttext" align="center" &gt;
</code></pre>

<p></p>

<p></p>

<pre><code>        &lt;tr&gt;
            &lt;td colspan="2" style="background-color: #E2E2E2"&gt;
                &lt;asp:Label cssClass="orangelogotext"  runat="server" ID="lblinformation" Text="Login :"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="center" style="background-color: #E2E2E2"&gt;
                &lt;asp:Label cssClass="smalltext"  runat="server" ID="lblEmail" Text="Email"&gt;
                &lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td style="background-color: #E2E2E2"&gt;
                &lt;asp:TextBox runat="server" ID="Email" CssClass="textbox"&gt;
                &lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="center" style="background-color: #E2E2E2"&gt;
                &lt;asp:Label cssClass="smalltext"  runat="server" ID="lblpassword" Text="Password" &gt;
                &lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td style="background-color: #E2E2E2"&gt;
                &lt;asp:TextBox runat="server" ID="Password"  Width="133px" TextMode="Password" CssClass="textbox"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="center" style="background-color: #E2E2E2"&gt;
                &lt;asp:Label cssClass="smalltext"  runat="server" ID="lblorganisationname" Text="Organisation Name"&gt;
                &lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td style="background-color: #E2E2E2"&gt; 
                &lt;asp:DropDownList ID="ddlorganisationname" runat="server" DataTextField="OrganisationName"
                    DataValueField="OrganisationID" CssClass="textbox"&gt;
                &lt;/asp:DropDownList&gt;
            &lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
            &lt;td align="center" colspan="2" style="background-color: #E2E2E2"&gt;
                &lt;asp:Button runat="server" ID="btnlogin" Text="LOGIN" Height="34px" onclick="btnlogin_Click;return validateForm()" CssClass="btntext" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
</code></pre>

<p>
</p>

<p></p>

<p>regards,
Dhriti</p>
