背後にあるコードから表示/非表示のdivは、私は次のようにボタンや進展に伴い、(ブートストラップ付)フォローHTMLページを持っている:ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestLoading.WebForm1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="/css/bootstrap.min.css" rel="stylesheet" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnSend" runat="server" OnClick="btnSend_Click" Text="Send" Width="71px" CssClass="btn btn-info" style="display: inline"/>
<div class="progress" runat="server" id="loadingSend">
<div class="progress-bar progress-bar-info progress-bar-striped active" aria-valuemax="100" aria-valuemin="0" aria-valuenow="100" role="progressbar" style="display: none">
Loading...
</div>
</div>
</div>
</form>
私は表示/非表示進行にしたいです背後にあるコードからバー、私が試したよ何:
private HttpWebRequest request;
protected void btnSend_Click(object sender, EventArgs e)
{
request = (HttpWebRequest)WebRequest.Create("http://localhost:65533/MyService.svc/");
request.Method = WebRequestMethods.Http.Get;
request.ContentType = "application/json";
HtmlControl control = FindControl("loadingSend") as HtmlControl;
control.Style.Add("display", "block");
request.BeginGetResponse(new AsyncCallback(FinishWebRequest), null);
}
void FinishWebRequest(IAsyncResult result)
{
StringBuilder sb = new StringBuilder();
request.EndGetResponse(result);
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
HtmlControl control = FindControl("loadingSend") as HtmlControl;
control.Style.Add("display", "none");
}
しかし、これは、私のために任意の提案を働いていませんか?
おかげ
こんにちは、おかげでその仕事とボタンのコールバックにそれを示すがFinishWebRequestで、それは私のために働くイマイチ要求がbtnSend_Click' – Evyatar
あなたは、要求は、あなたが任意のエラーを取得するか非同期 – Mairaj
'で終わるとき – Evyatar