在asp.net網站上工作。在其中一個頁面中,我使用了一個UpdatePanel和一個ProgressTemplate(它包含一個「updates.gif」)。在同一頁面上,我也有一個jQuery/bootstrap日期範圍選擇器。如何在UpdatePanel中觸發顯示ProgressTemplate?
當我選擇日期範圍時,我使用___doPostBack進行回發。一切工作正常,回傳等,但問題是updates.gif從未出現。但是,我希望它(至少在「處理」時)。
問題:我怎麼能在Page_Load等中使用javascript來做到這一點?謝謝!
更新面板被定義爲....
<asp:UpdateProgress runat="server" ID="UpdatePanel1_UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class="ajaxUpdatePanel">
</div>
<div style="position: absolute; padding: 30px;" class="updatingContainer">
<img src="../Images/updating.gif" alt="Updating" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
<ContentTemplate>
:
:
的日期範圍選取器被定義爲....
<asp:TextBox ID="daterange" name="daterange"
class="jQuery_DateRangePicker" runat="server" Width="110px"></asp:TextBox>
當選擇了日期我做到這一點(除其他事項外)....
__doPostBack('daterange', '');
我也試圖在這個包裝的JavaScript代碼,但沒有顯示....
$get('<%= UpdatePanel1_UpdateProgress1.ClientID %>').style.display = 'block';
// do all the processing
$get('<%= UpdatePanel1_UpdateProgress1.ClientID %>').style.display = 'none';
此頁面爲GridView和它需要一段時間來加載一些其他控件。其中一列是一個數據,我在列的標題行中使用這個數據範圍選擇器來選擇/過濾gridview中的數據。 @ Fenrir88 – WebDevGuy2
好吧,當daterange的文本改變時有回傳?你有沒有嘗試用asp方法而不是JS的doPostBack做回發?像OnTextChanged =「serverMethod」 – Fenrir88
不,我沒有嘗試過。你的意思是代碼背後的aspx,使用vb.net/c#?當我設置autopostback = true時,它似乎掛起頁面。我只是想知道我原來的問題。 javascript處理時可能顯示gif進度? – WebDevGuy2