Saturday, 15 March 2014

c# - How can I make a div visible Before the page has finished loading -


I have a page that I created using ASP.Net using WebForms.

I have a pair of updatesPanels who seem to be working properly but I have turned down a problem.

I have a combobox and when the value changes, it connects to TFS and receives the details of projects to populate a list box, it may take some time to complete Because our TFS server is in Australia and I am in the UK, so I thought I would show a little graphic to inform the user that its details are being loaded.

So here's an example I've done so far:

HTML:

  & lt; Asp: ScriptManager id = "ScriptManager1" runat = "server" /> & Lt; ASP: panel id = "inner left" runat = "server" cssClass = "innerContentPanel_Left" & gt; & Lt; ASP: Panel ID = "Panel 2" Runat = "Server" CssClass = "innerContentPanel_Border" & gt; & Lt; ASP: panel id = "panel3" runat = "server" css class = "run resultspan" & gt; & Lt; ASP: Labels ID = "Label2" runat = "server" text = "test suite:" & gt; & Lt; / Asp: Label & gt; & Lt; ASP: Dropdown list id = "test site" run = "server" changed indices selected = "test site editor selected" autopostback = "true" & gt; & Lt; Asp: ListItem selected = "true" & gt; Select a test suit & lt; / Asp: ListItem & gt; & Lt; ASP: ListItem & gt; Trades & lt; / ASP: ListItem & gt; & Lt; ASP: ListItem & gt; Dividend & lt; / ASP: ListItem & gt; & Lt; / ASP: DropDownList & gt; & Lt; / ASP: Cell & gt; & Lt; / ASP: Cell & gt; & Lt; / ASP: Cell & gt; & Lt; Asp: UpdatePanel ID = "Update Panel 1" Run = "Server" updatemod = "conditional" & gt; & Lt; Trigger & gt; & Lt; Asp: AsyncPostBackTrigger ControlID = "TestSuite" EventName = "Selected Index Changed" / & gt; & Lt; / Trigger & gt; & Lt; ContentTemplate & gt; & Lt; Asp: panel id = "loadingpanel" cssClass = "innerContentPanel_Border" runat = "server" visible = "false" & gt; & Lt; ASP: Panel ID = "TimeDiv" Runat = "Server" & gt; & Lt; Asp: Label ID = "Label6" runat = "server" text = "loading ..." & gt; & Lt; / Asp: Label & gt; & Lt; ASP: Panel ID = "Timer Animation" CssClass = "Timer" Run = "Server" & gt; & Lt; / Asp: panel & gt; & Lt; / ASP: Cell & gt; & Lt; / ASP: Cell & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt;  

C #:

  Secure Zero testSuite_SelectedIndexChanged (Object Sender, EventArgs E) {If (TestSuite.SelectedIndex & gt; 0) {// loading div Show LoadingPanel.Visible = true; // long-running code that takes stuff from TFS / pulling stuff from TFS, so div // LoadingPanel. View = false; }}  

is a code but what happens basically does not display the box unless the processing method has changed within the combobox.

Is there a way to look directly at that device, stuff?

I thought that putting the device in the updated panel and adding the trigger would allow it to update the asynchronous panel? Please forgive my ignorance if I am wrong about this, then the MSDN site has confused me.

EDIT: I have added some gelatin and it works to show a warning based on the on-line event. But whatever this will not do, it will be visible to the developer.

Here is the code:

  $ (document) .ready (function () {$ ("# & lt; (= (this option) .find ('option : Selected '). Text () === "Select a test suit") {Warning ("$ (" # = LP;% = LoadingPanel.ClientID%> "). Hide ();} and { Warning ("Show panel"); $ ("# & lt;% = LoadingPanel.ClientID% & Gt;") Show ();}})})  

Guessing I have to do something with postback and forget about this change? The default visibility for the DIV is set to false.

That's why every time a postback is done (which is every time When I change combo) I think, then it will have to go back basically. Or am I in the wrong area here?

TestSuite_SelectedIndexChanged is a server side event, so it will not show anything to the postback

Before you kick, some clients with javascript or jquery Side will need to be done:

No comments:

Post a Comment