Thursday, April 12, 2012

Call Jquery function in Content page and Normal aspx page

For Normal Page:

Note:If we use normal aspx page then we pass form ID in Jquery function for calling metheds of Jquery

<script src="jscripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="jscripts/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
    <script src="jscripts/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/jscript">

            jQuery(document).ready(function(){
            jQuery("#form1").validationEngine();
            });
 
    </script>


For Content page:

here we paas content page id which become as aspnetForm in running form(check for this in viewsource of content page)



<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" />
    <link rel="stylesheet" href="css/template.css" type="text/css" />
    <script src="jscripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="jscripts/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
    <script src="jscripts/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
   <script type="text/jscript">
            jQuery(document).ready(function(){
            jQuery("#aspnetForm").validationEngine();
            });
   
    </script>
   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <table cellpadding="0" cellspacing="0" border="0" width="60%" align="center" id="tbl">
        <tr>
            <td class="report_heading" colspan="2">
                Change Password</td>
        </tr>
        <tr>
            <td class="grid_row1" colspan="2">
                <asp:Label ID="LblMsg" runat="server" Text=""></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="grid_row1">
                Email ID:<font color="#CC0000">*</font></td>
            <td class="grid_row1">
                <asp:TextBox ID="txtEmailId" class="validate[required,custom[email]]" Width="348" runat="server" /></td>
        </tr>
        <tr>
            <td class="grid_row1">
                New Passowrd:<font color="#CC0000">*</font></td>
            <td class="grid_row1">
               <asp:TextBox ID="txtPassword" class="validate[required,custom[min]]" Width="348" runat="server" TextMode="Password"/></td>
        </tr>
         <tr>
            <td class="grid_row1">
                Confirm Passowrd:<font color="#CC0000">*</font></td>
            <td class="grid_row1">
                <asp:TextBox ID="txtConfirmPass" class="validate[required,equals[ctl00_ContentPlaceHolder1_txtPassword]]" Width="348" runat="server" TextMode="Password" />  </td>
        </tr>
        <tr>
            <td class="grid_row1">
                &nbsp;</td>
            <td class="grid_row1">
                <asp:Button ID="Submit" runat="server" CssClass="button" Text="Submit"
                    onclick="Submit_Click" /></td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
 
</asp:Content>

No comments:

Post a Comment