使用C#的一项调查显示进度条 [英] progress bar on a survey using c#

查看:168
本文介绍了使用C#的一项调查显示进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用C#在asp.net的网上调查。我的调查包括30个问题每个问题在不同的page.I要显示一个进度条会显示他是多么完成了用户。我该怎么做?

I made an on-line survey in asp.net using c#. My survey contains 30 questions each question on a different page.I want to display a progress bar that will show the user how much he completed. How can I do that?

推荐答案

您可以使用单独的图像或者你可以使用CSS的一个小一点来计算的:

You could use individual images or you could use a small bit of CSS to calculate this:

我们会假设我们知道我们在什么页面,它存储在变量某处在我们的code。

We'll suppose we know what page we're on and it's stored in a variable somewhere in our code.

鉴于此,我们可以做的当前进度的百分比快速计算:

Given that, we can do a quick percentage calculation of the current progress:

如果我们第3页:

3/30 * 100 = 10

通过这个存储在一个变量,我们可以用它来设置我们进步党条的宽度,相对于它的父:

With this stored in a variable we can use it to set the width of our progres bar, relative to its parent:

#myProgressBar{
  width: 10%;
}

(你会值写入使用自己选择的语言,C#在这种情况下,CSS语句)。

(You'd be writing the value to the CSS statement using your language of choice, C# in this case).

下面就是它会是什么样的快速示例:

Here's a quick sample of how it might look:

http://jsfiddle.net/QnbdZ/1/

这篇关于使用C#的一项调查显示进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆