Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In my building an Auction website which has an area, Where I need to implement a global timer (say for 10secs) for each products which are available for live biding. Whenever a user clicks the button "Submit" the timer must get reset and whenever the timer get expired then the last user that has made a bid must win the product. I'm fetching Product related Information from a table named "Table" from SQL Server database. So, whenever a user wins the product then that products status must be set to true (implying that product is sold) using a variable "Status". Please share how can I achieve it, Here's the code that I'm using.

C#
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="Timer.index" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .paneldesign
             {
  	            width:100px;
   	            height:150px;
   	            text-align:center;
   	            border-radius: 15px;	
             }
        .productlist li
             {
                display:inline;
                float:left;
                margin-left:10px;
                margin-bottom:10px;
             }
    </style>
</head>
<body>
    <form id="form" runat="server">
    <div>
        <asp:ListView DataSourceID="sqldtsrcpdt" ID="pdtlst" runat="server">
            <LayoutTemplate>
                <ul class="productlist">
                    <asp:PlaceHolder ID="itemPlaceholder" runat="server">
                    </asp:PlaceHolder>
                </ul>
                <br />
            </LayoutTemplate>
            <ItemTemplate>
                <li>
                    <asp:Panel ID="pnlpdt" CssClass="paneldesign" Width="200px" Height="150px" BorderColor="Black"                                               BorderWidth="3px" runat="server"><br />
                        <asp:Label ID="lblpdtid" runat="server" Text='<%#Eval("P_ID") %>' Visible="False">/asp:Label><br />
                        <asp:Label ID="lblpdtname" runat="server" Text='<%#Eval("Name") %>'></asp:Label><br />
                        <asp:Label ID="lbltmr" runat="server" ForeColor="Red" Text="Timer"></asp:Label> <br />
                        <asp:Button ID="btnsubmit" runat="server" Text="Submit" OnClick="btnsubmit_Click" />
                    </asp:Panel>   
                </li>
            </ItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="sqldtsrcpdt" runat="server" ConnectionString="<%$ ConnectionStrings:DtConStr %>" 
            SelectCommand="SELECT [P_ID], [Name], [Status] FROM [Table]">
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>


http://postimg.org/image/he7upat09/[^]
Posted
Comments
Kornfeld Eliyahu Peter 26-Oct-14 9:05am    
Global you mean - common for all the users in the auction room?
Atinesh 27-Oct-14 2:40am    
Ya
Member 11166224 6-Mar-17 23:56pm    
Here you can see.
http://dontcodetired.com/blog/post/Using-Server-Side-Timers-and-SignalR-in-ASPNET-MVC-Applications

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