QUESTION
Can anyone suggest how a loading image can be displayed until a gridview is fully loaded?
This gridview is to be rendered on page load. There must be a simple solution to detect when gridview is loading/loaded so a simple toggle between load image and gridview visibility can be achieved.
Please do not suggest using any of the Ajax toolkit methods unless the desired code can be isolated and used standalone. I have found the toolkit to be easy on implementation but bloated and slow on performance. I do not wish to include any scripts, files or code in my release package that is not going to be used.
ASP.NET
<img src="~/Loading.gif"></img>
<asp:GridView ID="gv" runat="Server" AutoGenerateColumns="False" EnableModelValidation="False">
'content...
</asp:GridView>
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'connection info
If Not IsPostBack Then
Me.Bindgv()
End If
End Sub
Private Sub Bindgv()
'Load gridview
End Sub
POSSIBILITIES
I am open to any suggestions however I was attemting to implement a solution using jquery page methods but need assistance to follow through.
JAVASCRIPT
$(function() {
$.ajax({
type: "POST",
url: "Default.aspx/UpdateGV",
data: "{}",
contentType: "application/json",
dataType: "json",
success: function() {
// Run return method.
}
});
});
VB.NET
Imports System.Web.Services
Public Partial Class _Default
Inherits System.Web.UI.Page
<WebMethod(EnableSession := False)> _
Public Shared Function UpdateGV() As String
Return
Me.Bindgv()
End Function
End Class