有人可以帮助我进度吧

时间:2012-05-14 08:58:33

标签: c# asp.net asp.net-ajax

我在这里使用了这个例子

http://www.asp.net/ajaxlibrary/jqueryui_progressbar.ashx

除了进度

之外,每件事情都运作正常

enter image description here

这是我的设计

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default15.aspx.cs" Inherits="Default15" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css"
        rel="Stylesheet" />
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $("#progress").progressbar({
            value: document.getElementById('<%=litprogress.ClientID%>').value
        });  
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>
            Wizard progress</h1>
        <div id="progress">
            <asp:Literal ID="litprogress" runat="server"></asp:Literal>
        </div>
        <asp:Panel ID="step1" runat="server">
            <h1>
                Step 1</h1>
            <asp:Button ID="GoToStep2" Text="Next" runat="server" OnClick="GoToStep2_Click" />
        </asp:Panel>
        <asp:Panel ID="step2" runat="server">
            <h1>
                Step 2</h1>
            <asp:Button ID="GoToStep3" Text="Next" runat="server" OnClick="GoToStep3_Click" />
        </asp:Panel>
        <asp:Panel ID="step3" runat="server">
            <h1>
                Step 3</h1>
            <asp:Button ID="GoToStep4" Text="Next" runat="server" OnClick="GoToStep4_Click" />
        </asp:Panel>
        <asp:Panel ID="step4" runat="server">
            <h1>
                Completed</h1>
        </asp:Panel>
    </div>
    </form>
</body>
</html>

而不是要求我得到这个

enter image description here

任何人都可以告诉我哪里出错了

获取有关CSS的一些警告,错误如下

Error: document.getElementById("litprogress") is null

1 个答案:

答案 0 :(得分:1)

我认为进度条init在DOM完全加载之前发生,将代码放在$(document).ready.