How can call a JQuery function when it in side the from view (asp.net control)?

Posted by ricky roy on Stack Overflow See other posts from Stack Overflow or by ricky roy
Published on 2010-04-23T09:36:34Z Indexed on 2010/04/23 9:53 UTC
Read the original article Hit count: 248

Filed under:
|

Hi,

All I have a Span in side the Form view. I wanted to Call a Jquery Fucntion when the from load how can i do this?

Thanks Waiting for your reply

here is my code

 <asp:FormView ID="FormView1" runat="server" OnItemCommand="FormView1_ItemCommand">
            <ItemTemplate>
                <asp:HiddenField ID="hidProductID" Value='<%#Eval("ProductID") %>' runat="server" />
                <asp:HiddenField ID="hidCustomerID" Value='<%#Eval("CustomerID") %>' runat="server" />
                <a href='<%=WinToSave.SettingsConstants.SiteURL%>WintoSave/AuctionProduct.aspx?id=<%#Eval("ProductID") %>'>
                    <%#Eval("ProductName")%>
                </a>
                <br />
                <img src='<%#Eval("ImagePath")%>' alt="Image No available" />
                <br />
                <asp:Label ID="lblTime" runat="server" Text='<%#Convert.ToDateTime(Eval("ModifiedOn")).ToString("hh:mm:ss") %>'></asp:Label>

                 <span id='Countdown_<%#Eval("ProductID") %>' onload="GetTimeOnLoad('<%#Eval("ModifiedOn")%>','Countdown_<%#Eval("ProductID") %>');"></span>
                <br />
                <asp:Label ID="lblFinalPrice" runat="server" Text='<%#Convert.ToDouble(Eval("FinalPrice")).ToString("#.00")%>'></asp:Label>
                <br />
                <asp:Label ID="lblFullName" runat="server" Text='<%#Eval("FullName") %>'></asp:Label>
                <br />
                <asp:Button ID="btnAddbid" Text="Bid" CommandName="AddBid" CommandArgument='<%#Eval("ID")%>'
                    runat="server" />
            </ItemTemplate>
        </asp:FormView>

and following is my jquery code

   function GetTimeOnLoad(shortly,DivID)
   {
    var dt = new Date(shortly);
    alert(dt);
    alert(shortly);
    alert(DivID);
    var ProductDivID = "#" +DivID;
    alert(ProductDivID);
     $(ProductDivID).countdown({
            until: dt, onExpiry: liftOff, onTick: watchCountdown,
            format: 'HMS', layout: '{hnn}{sep}{mnn}{sep}{snn}'
        });
   }
   function liftOff(){};
   function watchCountdown(){};

In above code I Used ' onload="GetTimeOnLoad('<%#Eval("ModifiedOn")%>','Countdown_<%#Eval("ProductID") %>');"> but is not working

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery