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
Hi,
I’ve WebGrid, and defined BindingOperationMode="ClientBinding" AllowAddNew="Yes". Also set DataSourceType="WebService".
If the grid is empty and has 0 rows, and after adding the first rows, and trying to check grid.TotalRows it always return 0 unless I refresh the grid which is causing some issues to my application.
Can you please check it and let me know?
Thanks,
Please try to obtain the total rows by using following snippet code.
WebGrid1.RootTable.Rows.length
I have tested that the "Rows.length" returns correct amount of total loaded rows of WebGrid. I also have tested the scenario where the Grid starts with empty grid (no rows).
Hope this helps.
I tested the issue in a simple sample of Client-Binding WebGrid and was unable to reproduce the issue on my local end.
I’m afraid that there is something that I missed during my attempt in order to replicate the issue. I’m willing to advice you further but in order to do so I would need you to elaborate on your specific scenario and possibly give me a running simple sample that I can use to observe the problematic behavior.
Just to confirm it with you. You need to start with very empty grid that has no rows, and just add a new row and don't refresh, and then try to have a button that call a client side function that just display the grid TotalRows.
Please send me your sample to compare it with my code.
I can not send you my code as its large project that has many dependencies. But here is snapshot:
The grid definition:
<ISWebGrid:WebGrid ID="MembershipTypePricesWebGrid" runat="server" DefaultStyleMode="Win7" Height="340px" UseDefaultStyle="True" Width="99%" BindingOperationMode="ClientBinding"> <LayoutSettings AllowEdit="Yes" AllowSorting="Yes" AlwaysShowHelpButton="False" InProgressUIBehavior="ChangeCursorToHourGlass" RowHeaders="Default" ShowRefreshButton="True" StatusBarVisible="True" TreeLines="False" AllowAddNew="Yes" EditOnClick="True" AllowColumnSizing="No" AllowContextMenu="False" NewRowLostFocusAction="AlwaysPrompt"> <ClientSideEvents OnBeginRowEditing="CheckNewRowsAddedToGrid" OnBeforeRowSelect="CheckNewRowsAddedToGrid" /> <NewRowStyle BackColor="#FBF7AE" BackColor2="AliceBlue" BaseStyle="Active" Cursor="Text" Font-Italic="True" > </NewRowStyle> </LayoutSettings> <RootTable Caption="MembershipTypeProduct" DataKeyField="MembershipTypePriceID"> <Columns> <ISWebGrid:WebGridColumn Caption="Effective Date" DataMember="EffectiveDate" Name="EffectiveDate" Width="240px" EditType="CalendarDropdown" DataFormatString="d" DataType="System.Date"> <HeaderStyle Cursor="Hand" Font-Italic="True" Font-Underline="True" HorizontalAlign="Center" /> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Member Category" DataMember="MemberCategoryName" DataType="System.String" EditType="WebComboNET" Name="MemberCategoryName" WebComboID="PricesMemberCategoryCombo" Width="240px"> <HeaderStyle Cursor="Hand" Font-Italic="True" Font-Underline="True" HorizontalAlign="Center" /> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Member Charge" DataMember="MemberPrice" Name="MemberPrice" Width="240px"> <HeaderStyle Cursor="Hand" Font-Italic="True" Font-Underline="True" HorizontalAlign="Center" /> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ID" DataMember="MembershipTypePriceID" Name="MembershipTypePriceID" Width="70px" EditType="NoEdit" Visible="false"> <HeaderStyle Cursor="Hand" Font-Italic="True" Font-Underline="True" HorizontalAlign="Center" /> </ISWebGrid:WebGridColumn> </Columns> </RootTable> <ClientBindingSettings DataSourceType="WebService" ServiceUrl="../MembershipDataService.asmx" DataLoadMode="AllData" ItemTypeName="MembershipTypePrice" > <ServiceMethods SelectMethod="GetMembershipTypePrices" UpdateMethod="UpdateMembershipTypePrices" InsertMethod="InsertMembershipTypePrice" /> <ServiceEvents Selecting="Selecting_MembershipTypeItem" Updating="Updating_MembershipTypePrice" Inserting="Inserting_MembershipTypePrice" /> </ClientBindingSettings> </ISWebGrid:WebGrid> </PageTemplate> </ISWebDesktop:WebTabItem>
The function to calculate the total rows:
/// /// /// function CheckNewRowsAddedToGrid(controlId) { try { var grid = ISGetObject(controlId); for (var i = 0; i < grid.TotalRows; i++) { var row = grid.RootTable.GetRow(i); if(row.KeyValue < 1) { grid.Refresh(); return false; } } } catch (err) { alert("CheckNewRowsAddedToGrid: " + err.description); } return true; }
Please try to replicate this code at your sample.
Maged
I’m currently still investigating this issue and need more time to provide you with solution, suggestion, or sample.
I’ll get back to you as soon as possible.
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