TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Simran Rani
NA
19
383
I am trying to show the count in a label based on the time
Apr 2 2019 1:54 AM
I am trying to show the count in a label based on the time using timespan
but label always null
while i am debugging the code there are showing the count value in the label but not on the browser
public
partial
class
_Default : System.Web.UI.Page
{
public
int
j;
public
int
numoffers = 6000;
public
int
i;
protected
void
Page_Load(
object
sender, EventArgs e)
{
SetInterval(() => calculate(), TimeSpan.FromSeconds(10));
}
public
void
calculate()
{
DateTime time = DateTime.Now;
int
hour = time.Hour;
int
minute = time.Minute;
int
second = time.Second;
int
numofdays = 90;
int
num = Check_Prime(minute);
int
numofperday = numoffers / numofdays;
if
(minute % 2 == 0)
{
j = j + 2;
i = numoffers - j;
}
else
{
if
(num == 1)
{
j = j + 3;
i = numoffers - j;
}
else
{
j = j + 5;
i = numoffers - j;
}
}
if
(j >=6000)
{
Thread.Sleep(TimeSpan.FromSeconds(100000));
}
Label2.Text = i.ToString();
}
public
async Task SetInterval(Action action, TimeSpan timeout)
{
await Task.Delay(timeout).ConfigureAwait(
false
);
action();
SetInterval(action, timeout);
}
private
int
Check_Prime(
int
number)
{
int
i;
for
(i = 2; i <= number - 1; i++)
{
if
(number % i == 0)
{
return
0;
}
}
if
(i == number)
{
return
1;
}
return
0;
}
}
Reply
Answers (
1
)
how to encrypt the EMPID
User Login username is given then display the password box