iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I'm loading a grid using the InitializeDataSource event calling a Data Class to get 50 rows of data from an oracle database. In the InitializeDataSource event, I can get the sortExpression and the number of records to bring back, but I can't figure out how to get the startRowIndex from. I know it's simple but can't sem to figure it out!
MORE: I see that for PagingMode="VirtualLoad" this works fine, but I want to do ClassicPaging. Is there a way to do Custom Loading and Classic Paging without using a DataSource control?
Thanks
john
Hi John,
From information that you mentioned above, you want to make Classic paging that show the index of data that has been loaded to WebGrid. You can do this with ClassicPaging but you must handle the index in client-side event.
I've made my own sample that show your scenario. In my sample I'm using Access Database instead of Oracle Database. And I'm not using DataSourceControl like your scenario. I attach my sample here.
Hope this helps.
Regards,
Bernard
Thanks Bernard, I'm not looking to display the index. I guess I didn't explain what I need.
I have database that has over 120K records, I want to use Custom Loading and Classic paging. I have a data class that calls an Oracle data package that gets the startRowIndex, maximumRecors and sortExpression which then returns 50 records at a time, when the user moved to the next page, the grid gets the next 50 records. I don't want to use a DataSource control and have my code pass these parameters to my data class. My question is can I do this without a data source control?
Actually, you couldn't do Custom PagingLoadMode in ClassicPaging without using DataSource. WebGrid automatically sends the parameter to DataSource so it can configure its Paging. Currently, only ISDataSource and ObjectDataSource that support Paging. However, I recommend you to use ISDataSource for this scenario. ISDataSource can takes data from your class as CustomObject so you can do your paging. Hope this helps.
For more information, see http://intersoftpt.com/Support/WebGrid/Documentation/#url=topic511.html
<isdatasource:isdatasource id="ISDataSource1" runat="server" schematype="CustomObject" LoadOnDemand="True"> <tables> <ISDataSource:ISDataSourceTable SelectMethod="getAllRDR" TypeName="RDRDetails" TableName="RDRTable" SelectCountMethod="getAllRDRCount" EnablePaging="true"> <SelectParameters> <asp:Parameter Name="_userID" Type="String" /> <asp:Parameter Name="_where" Type="String" /> <asp:Parameter Name="startRowIndex" Type="Int32" /> <asp:Parameter Name="maximumRows" Type="Int32" /> <asp:Parameter Name="sortExpression" Type="String" /> </SelectParameters> </ISDataSource:ISDataSourceTable> </tables> </isdatasource:isdatasource>Here is the function getAllRDR in the Class object: <System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, False)> _ Public Function getAllRDR(ByVal _userID As String, ByVal _where As String, ByVal startRowIndex As Integer, ByVal maximumRows As Integer, ByVal sortExpression As String) As DataTable Dim reader As OracleDataReader = Nothing Dim oDT As DataTable = New DataTable() _where = Replace(_where, "AND ", "WHERE ") Using conn As OracleConnection = New OracleConnection(ConfigurationManager.ConnectionStrings("conn").ToString) Dim cmd As OracleCommand = conn.CreateCommand() conn.Open() cmd.CommandText = "data_access.get_all_rdrs" cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("p_user", OracleDbType.Varchar2).Value = _userID cmd.Parameters.Add("p_where", OracleDbType.Varchar2).Value = _where cmd.Parameters.Add("p_start", OracleDbType.Decimal).Value = startRowIndex cmd.Parameters.Add("p_max", OracleDbType.Decimal).Value = maximumRows cmd.Parameters.Add("p_sort", OracleDbType.Varchar2).Value = sortExpression cmd.Parameters.Add("out_data", OracleDbType.RefCursor).Direction = ParameterDirection.InputOutput reader = cmd.ExecuteReader oDT.Load(reader, LoadOption.OverwriteChanges) reader.Close() Return oDT End Using End Function
When I put a breakpoint in the getALLRDR class an look at the parameters, startRowIndex and maximumRows is zero.Not sure what I am missing here...thanks
I think this walkthough will help you. You can go to WebGrid's Documentation (http://intersoftpt.com/Support/WebGrid/Documentation/), go to Walkthrough Topics tab, then you can see Walkthrough: Implementing Custom Paging using ISDataSource inside Paging Data sub topic.
Thanks Bernard, I'll take a look and will get back to you if I have any questions.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname