Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have to activate submit button when timer reaches to 00:00:000 and send the information to save in database using wcf service in my mvc application pls tell me how can i achieve this. i am new to wcf and mvc


XML
i have to start timer on .cshtml view page of my mvc application the way asp timer starts on page_load of asp.net application .for this i want to use controller action method and i am desparate to do it using wcf service

<pre lang="xml"><asp:UpdatePanel ID="up"  UpdateMode="Conditional"  runat="server">
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="tm" EventName="Tick" /></Triggers>
        <ContentTemplate>
           <div style="position:absolute;   top: 265px; left: 600px; height: 20px;  width:150px; " id="col" runat="server">
                <asp:Label ID="lbtime" Font-Bold="true"  Width="100"  ForeColor="White" runat="server" ></asp:Label></div>


<asp:Label ID="lbtime0" runat="server" Font-Bold="true" ForeColor="Black" ></asp:Label>



            </ContentTemplate>
            </asp:UpdatePanel></pre>



in code behind

<pre lang="cs">protected void Timer_Tick(object sender, EventArgs e)
  {</pre>
  //  lbtime.Visible = true;
        if (sender == tm)
        {

            string s = Convert.ToString(Request.Cookies["Contest"].Value);
            sqlread = dclass.GetRead("select * from CEntry where ContestTitle='" + Request.Cookies["Contest"].Value + "'");
            if (sqlread.Read())
            {
                DateTime startDate = System.DateTime.Now;
                DateTime timetoexpirecontest = Convert.ToDateTime(sqlread["Duration"]);

                TimeSpan t = timetoexpirecontest - startDate;
                // TimeSpan t2 = new TimeSpan(11,0,0);
                //   t = t.Add(t2);

                if (t.Days <= 0 && t.Hours <= 0 && t.Minutes <= 0 && t.Seconds <= 0)
                {

//countdown action

//disable button
}
}

}
}

i want to achieve timer tick event  means above mention thing in mvc 's controller action method
and that too using wcf service that's why tell me every thing means where to set timer ,how to  coutdown it dynamically using database in mvc 3.0 razor
Posted
Comments
Krunal Rohit 15-Apr-14 2:43am    
Please format it properly first.

-KR

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