进度栏问题:最终结果未显示
我的进度条有问题。现在我已经浏览了溢出中的所有问题,并且我已经进行了大量的谷歌搜索。我可能忽略了一些事情,但我敢打赌,这个问题确实是我一直忽略的事情。协议如下。
我的进度条似乎工作得很好。我使用ajax,所有内容都在右侧面板中,按下按钮时它会立即触发,实际上一旦过程完成它就会停止(尽管我不知道我是如何做到的)。请注意,这很简单。它只是一个 GIF,没什么特别的。使用 Visual Studio 2010、SQL Server 2008、Ajax 和 C#。我没有使用 jquery 或 js,尽管我可能也使用过。
我的申请很简单。它将订单发送到不同的服务器,所以我在客户端。单击按钮后,订单即将发送。我的问题是,尽管正在发送订单,但当进度条停止并且该过程完成时,我的标签(成功或错误)和订单数据库表不会触发。这是为什么呢?我觉得这很奇怪,因为应用程序发送订单,它 100% 运行,但用户端没有任何变化。
这是一些代码,如果您需要更多代码,请直接说出。提前谢谢大家!
protected void Page_Load(object sender, EventArgs e)
{
Initialize();
}
protected void Page_PreRender(object sender, EventArgs e)
{
}
protected void Button_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Button btn = (Button)sender;
KaplanFTP.BatchFiles bf = new KaplanFTP.BatchFiles();
KaplanFTP.Transmit transmit = new KaplanFTP.Transmit();
if (btn.ID == PutFTPButton.ID)
{//code
private void Initialize()
{//code if success/notsuccess labels will fire
如果有帮助的话,这里还有设计代码
<body>
<form id="form1" runat="server">
<div class="mainPanel">
<div>
<h3>Number of Batches Created Today: <asp:Label runat="server" style="display:inline;" ID="BatchesCreatedLbl"></asp:Label></h3>
</div>
<div id="batchestoprocessdiv">
<asp:Label runat="server" ID="BatchesToProcessLbl" Text="THERE IS AN ORDER BATCH TO PROCESS." CssClass="green"></asp:Label>
</div>
<asp:Label runat="server" ID="NoBatchesToProcessLbl" Text="There are no Order Batches to Process." CssClass="red"
Visible="false"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="PutFTPButton" runat="server" onclick="Button_Click"
Text="Submit Orders" />
</ContentTemplate>
</asp:UpdatePanel>
<span class="red">COUNTDOWN TO SUBMISSION!</span>
<span id="timespan" class="red">
</span>
<asp:Label runat="server" ID="ErrorLabel" Visible="false" CssClass="red" Text="Error: "></asp:Label>
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img alt="" class="style1" src="images/ajax-loader.gif" />
<br />
<asp:Label ID="Label1" runat="server" CssClass="red" Height="16px"
Text="Sending Orders....Please Wait"></asp:Label>
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<br />
<br />
<asp:Label runat="server" ID="SuccessLabel" Visible="false" CssClass="green" Text="Batch has been processed and uploaded successfully."></asp:Label>
</div>
<div id="OrdersInfoDiv" runat="server" visible="false">
<asp:GridView ID="BatchDetails" Caption="Details of orders ready to be sent" runat="server" AutoGenerateColumns="true"
CssClass="InfoTable" AlternatingRowStyle-CssClass="InfoTableAlternateRow" >
</asp:GridView>
</div>
<div id="OrdersSentDiv" class="mainPanel" runat="server" visible="false">
<h4>Sent Orders</h4>
</div>
</form>
<script src="js/SendOrders.js" type="text/javascript"></script>
</body>
Im having an issue with my progress bar. Now I have looked through all of the questions in overflow and Ive been through alot of google searching. I may have overlooked something, but Ill bet you anything this problem is something really simply I keep overlooking. Heres the deal.
My progress bar seems to work just fine. Im using ajax, everything is in the right panel, it fires immediatly when the button is pushed and actually it stops once the process is completed (although I have no idea how I did that). Please note, this is as simple as it gets. Its just a GIF, nothing special. Using Visual Studio 2010, SQL Server 2008, Ajax, and C#. Im not using a jquery or js, although I may have too.
My application is simple. It sends orders to a different server, so I am on the client side. Once the button is clicked, the orders are in the process of being sent. My Problem is, although the orders are being sent, when the progress bar stops, and the process is done, my labels (success or error) and order database tables do not fire. Why is this? I find this very odd because the application sends the orders, it functions 100%, but nothing changes on the user side.
Here is some code, if you need more then just say the word. Thank you all in advance!
protected void Page_Load(object sender, EventArgs e)
{
Initialize();
}
protected void Page_PreRender(object sender, EventArgs e)
{
}
protected void Button_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Button btn = (Button)sender;
KaplanFTP.BatchFiles bf = new KaplanFTP.BatchFiles();
KaplanFTP.Transmit transmit = new KaplanFTP.Transmit();
if (btn.ID == PutFTPButton.ID)
{//code
private void Initialize()
{//code if success/notsuccess labels will fire
Also here is the design code if it helps
<body>
<form id="form1" runat="server">
<div class="mainPanel">
<div>
<h3>Number of Batches Created Today: <asp:Label runat="server" style="display:inline;" ID="BatchesCreatedLbl"></asp:Label></h3>
</div>
<div id="batchestoprocessdiv">
<asp:Label runat="server" ID="BatchesToProcessLbl" Text="THERE IS AN ORDER BATCH TO PROCESS." CssClass="green"></asp:Label>
</div>
<asp:Label runat="server" ID="NoBatchesToProcessLbl" Text="There are no Order Batches to Process." CssClass="red"
Visible="false"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="PutFTPButton" runat="server" onclick="Button_Click"
Text="Submit Orders" />
</ContentTemplate>
</asp:UpdatePanel>
<span class="red">COUNTDOWN TO SUBMISSION!</span>
<span id="timespan" class="red">
</span>
<asp:Label runat="server" ID="ErrorLabel" Visible="false" CssClass="red" Text="Error: "></asp:Label>
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img alt="" class="style1" src="images/ajax-loader.gif" />
<br />
<asp:Label ID="Label1" runat="server" CssClass="red" Height="16px"
Text="Sending Orders....Please Wait"></asp:Label>
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<br />
<br />
<asp:Label runat="server" ID="SuccessLabel" Visible="false" CssClass="green" Text="Batch has been processed and uploaded successfully."></asp:Label>
</div>
<div id="OrdersInfoDiv" runat="server" visible="false">
<asp:GridView ID="BatchDetails" Caption="Details of orders ready to be sent" runat="server" AutoGenerateColumns="true"
CssClass="InfoTable" AlternatingRowStyle-CssClass="InfoTableAlternateRow" >
</asp:GridView>
</div>
<div id="OrdersSentDiv" class="mainPanel" runat="server" visible="false">
<h4>Sent Orders</h4>
</div>
</form>
<script src="js/SendOrders.js" type="text/javascript"></script>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将下载完成后要刷新的所有内容放入 UpdatePanel 中
UpdateMode="Always"
Put all content those you want to refresh after download finished into UpdatePanel with
UpdateMode="Always"