c# - Session doesn't get decimal numbers -
c# - Session doesn't get decimal numbers -
i made progress bar survey ran problem it. each question person answers, progress bar should move/ fill x amount based on these calculations:
progresspercent = 100 / number of questions.
it works if there no decimal numbers 100 / 50 = 2. if number of questions equal 60, math 100 / 60 = 1.6666 when pass number session keeps 1 , forgets 6666
here number of questions:
cnt = ds.tables[0].rows.count;
then calculate progresspercent shall ryze with:
session["progresspercent"] = 100 / cnt;
then update progress bar setting width:
int progress = convert.toint32(session["progress"].tostring()); int progressprocent = convert.toint32(session["progressprocent"].tostring()); progress += progressprocent; session["progress"] = progress; statusmeter.style.add("width", session["progress"].tostring() + "%");
this tried:
int total = 100; int amount = cnt; double progresspercent = (double)full / amount; session["progresspercent"] = progresspercent;
then 1.66 session problems lastly part of updating progress bar correctly.
how can prepare this?
c# asp.net progress-bar
Comments
Post a Comment