user1150440
user1150440

Reputation: 449

please wait loading message

Screenshot of the page

enter image description here

ASPX CODE

<div style="width:729px;background:white;">
<div id="tabs">
<div><asp:LinkButton ID="LinkButtonDefinitions" runat="server">Definitions</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonEmployees" runat="server">Employees</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonFamily" runat="server">Family</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonHomeTown" runat="server">Home Town</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonOtherThanHomeTown" runat="server">Other Than Home Town</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonAdmissibility" runat="server">Admissibility</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonTypesOfLTC" runat="server">Types Of LTC</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonBlockPeriod" runat="server">Block Period</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonEntitlement" runat="server">Entitlement</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonAdvance" runat="server">Advance</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonAdjustmentofadvance" runat="server">Adjustment of advance</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonReimbursement" runat="server">Reimbursement</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButtonCarryOverForfeitureofclaim" runat="server">Carry Over & Forfeiture of claim</asp:LinkButton></div>
<div><asp:LinkButton ID="LinkButton1RelaxationsInterpretations" runat="server">Relaxations & Interpretations</asp:LinkButton></div>
</div>
</div>

CODE BEHIND

Public Sub loadContent(ByVal PageName As String)
  Dim _con As New SqlConnection(ConfigurationManager.ConnectionStrings("LeaveDBConnectionString").ConnectionString)
  Dim _da As New SqlDataAdapter("SELECT PageHeader,PageContent FROM PageKeeper WHERE PageName='" & PageName & "'", _con)
  Dim _table As New DataTable

  Try
    _con.Open()
    _da.Fill(_table)
    _con.Close()
    _con.Dispose()
    With _table.Rows(0)
      h4header.InnerText = .Item(0)
      divUpdatePanel.InnerHtml = .Item(1)
      Me.Title = .Item(0)
    End With
  Catch ex As Exception
   'MsgBox(ex.Message)
    divUpdatePanel.InnerText = "No Data Found"
  Finally
    _con.Close()
    _con.Dispose()
  End Try
End Sub

Protected Sub LinkButtonEmployees_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButtonEmployees.Click
  loadContent("Employees")
End Sub

PROBLEM

When i click on the tabs ,it takes a few secs to reflect the data...i want to show a "please wait loading" message to the user which should disappear automatically after the data is shown.

UPDATE: ASPX code is inside an UPdatePanel so clicking on the tabs does an Asynchronous postback.Thanks.

Upvotes: 0

Views: 3832

Answers (3)

Bharath
Bharath

Reputation: 807

Simple solution. place the "divUpdatePanel" inside and asp:UpdatePanel. Set linkbutton as Triggers to achieve this

Upvotes: 0

Ravi Gadag
Ravi Gadag

Reputation: 15861

using Ajax you can update the partially. or you can try to use Async Triggers in the update panel. Ajax Update Panels

alternativily, you can use Update Progress, to show the indication. like this .

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
 </asp:UpdatePanel>

asscoiate your update panel to the update progreess area.

<asp:updateprogress id="UpdateProgress1" runat="server" associatedupdatepanelid="UpdatePanel1" dynamiclayout="true">
<progresstemplate>
<img src="support/images/loading.gif">
</progresstemplate>
</asp:updateprogress>

Upvotes: 1

GrantVS
GrantVS

Reputation: 2221

Best to use AJAX for this kind of thing. Threading is not going to help because the server will wait until all those threads have finished before returning the response to the client. Load the page with the message and then load the data using AJAX.

Upvotes: 1

Related Questions