This is the code behind. You will see the ToScript method that is used to script out the window that is defined in the markup:
Partial Class UserControls_ucUsers
Inherits Common.BaseExtWindowUserControl
Public Overrides Function ToScript() As String
Me.winUsers.DoLayout()
Return Me.winUsers.ToScript()
End Function
Public Overrides Sub DisplayInfo(ByVal Parameter As Object)
Dim oParameter As Ext.Net.Parameter
oParameter = Me.storeUsers.AutoLoadParams(1)
oParameter.Value = Common.Utility.GetDefaultPageSize
Me.pageToolBarUsers.PageSize = Common.Utility.GetDefaultPageSize
End Sub
End Class
Below is the actual web service calls to return the scripted window:
<WebMethod(EnableSession:=True)> _
Public Function GetUsersListScreen() As Ext.Net.DirectResponse
Dim oUserControl As New UserControl
Dim oControl As Common.BaseExtWindowUserControl = CType(oUserControl.LoadControl("~/UserControls/ucUsers.ascx"), Common.BaseExtWindowUserControl)
oControl.DisplayInfo(Nothing)
Dim strWindow As String = oControl.ToScript()
Return New Ext.Net.DirectResponse(strWindow)
End Function
This web service method is called by the store that is a child of the grid control that belongs to the scripted window:
<WebMethod(EnableSession:=True)> _
Public Function GetUsers(ByVal Start As Integer, ByVal Limit As Integer, ByVal Sort As String, ByVal Dir As String, ByVal filter As String) As Ext.Net.Paging(Of PRG_User)
Return (New Security.UserMaintenance).GetUsers(Start, Limit, Sort, Dir, filter)
End Function
And finally, this is the code that returns the user data using Linq To Sql from our database:
Public Function GetUsers(ByVal Start As Integer, ByVal Limit As Integer, ByVal Sort As String, ByVal Dir As String, ByVal filter As String) As Ext.Net.Paging(Of PRG_User)
Dim oDataContext As New ProgressorDataContext()
If Sort = String.Empty Then
Sort = "UserId"
End If
qryResults = oDataContext.PRG_Users.Skip(Start).Take(Limit).OrderBy(Sort)
Return New Ext.Net.Paging(Of PRG_User)(qryResults.ToList, oDataContext.PRG_Users.Count)
End Function