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
Actually I have the same problem and I'm using WebGrid 7.0.
I have a dropdown on the page that will determine what data should be loaded in the page.
I have included snippets of code so I could show my approach. Not sure what I'm doing wrong. When I remove the UpdatePanels it works fine.
I have a script manager on the page and I'm using
aspx:<table id="idx4" class="clsBgTable" width="100%" style="PADDING-left: 5px; PADDING-TOP: 5px;display:block;width:100%" border="1" cellpadding="0" cellspacing="0" > <tr> <td style="vertical-align:top; text-align:left;" nowrap="nowrap"> <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlLoadedAccounts" runat="server" ToolTip="Loaded Accounts" AutoPostBack="True" onselectedindexchanged="ddlLoadedAccounts_SelectedIndexChanged"></asp:DropDownList> <asp:Button ID="btnDistribute" runat="server" CssClass="clsSmallButton" Text="DISTRIBUTE ACCOUNT" onclick="btnDistribute_Click" /> <asp:Button id="btnDistSelected" runat="server" CssClass="clsSmallButton" Text="DISTRIBUTE SELECTED ASSETS" onclick="btnDistSelected_Click" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlLoadedAccounts" /> </Triggers> </asp:UpdatePanel> </td> </tr> <tr> <td> <ISWebGrid:WebGrid ID="WebGrid1" runat="server" UseDefaultStyle="false" Height="425px" Width="700px" onbatchupdate="WebGrid1_BatchUpdate" oninitializelayout="WebGrid1_InitializeLayout" onexport="WebGrid1_Export"> <RootTable DataKeyField="AssetId"> <Columns> . . . </Columns> </RootTable> <LayoutSettings AllowAddNew="No" AllowColumnSizing="Yes" AllowColumnMove="Yes" AllowDelete="No" AllowEdit="Yes" AllowExport="Yes" AllowFilter="Yes" AllowGrouping="No" AllowSelectColumns="Yes" AllowSorting="Yes" GridLineColor="#CCCCCC" GridLines="Both" GridLineStyle="Solid" PagingMode="ClassicPaging" PagingSize="500" AllowBatchUpdate="true" PagingStyleUI="FirstPrevNextLast" AllowMultipleSelection="No" GroupByBoxVisible="false" HeaderClickAction="SortMulti" VerboseEditingInformation="true" NewRowLostFocusAction="AlwaysUpdate" FocusNewRowOnLastCell="true" AllowColumnFreezing="Yes" ApplyFiltersKey="Enter" EditOnClick="True" AutoHeight="false" AutoWidth="false" AutoFilterSuggestion="true" PagingExportMode="ExportAllData" ShowFilterStatus="true" InProgressUIBehavior="ChangeCursorToHourGlass" ColumnFooters="Yes" HeaderWrapDefault="true" ColumnFooterAggregateMode="CalculateAllData" ShowColumnAction="true" PersistRowChecker="True"> <FreezePaneSettings ShowInContextMenu="true" MaxFrozenColumns="6" /> <BatchUpdateSettings AllowReviewChanges="True" HighlightChanges="true" PromptUnsavedChanges="true" /> <ClientSideEvents OnAfterExitEditMode="WebGrid1_OnCellValidate" OnUndoChanges="WebGrid1_OnUndoChanges" OnEnterEditMode="WebGrid1_OnEnterEditMode" /> <EditFocusCellStyle CssClass="EditFocusCellStyle"> </EditFocusCellStyle> <EditTextboxStyle CssClass="EditTextboxStyle"> </EditTextboxStyle> <FrameStyle CssClass="FrameStyle"> </FrameStyle> <GroupByBox> <Style CssClass="GroupByBoxStyle"> </Style> <LabelStyle CssClass="GroupByBoxLabelStyle" /> </GroupByBox> <GroupRowInfoStyle CssClass="GroupRowInfoStyle"> </GroupRowInfoStyle> <AlternatingRowStyle CssClass="AlternatingRowStyle"></AlternatingRowStyle> <RowStyle CssClass="RowStyle" Wrap="true"></RowStyle> <SelectedRowStyle CssClass="SelectedRowStyle" /> <HeaderStyle CssClass="HeaderStyle" Wrap="true"></HeaderStyle> <NewRowStyle CssClass="NewRowStyle"> </NewRowStyle> <FooterStyle CssClass="FooterStyle" /> <StatusBarStyle CssClass="StatusBarStyle"> </StatusBarStyle> <StatusBarCommandStyle> <Normal CssClass="StatusBarCommandStyleNormal"> </Normal> <Over CssClass="StatusBarCommandStyleOver"> </Over> <Active CssClass="StatusBarCommandStyleOver"> </Active> </StatusBarCommandStyle> <HyperlinkStyle CssClass="HyperlinkStyle" /> <DeletedRowStyle CssClass="DeletedRowStyle"> </DeletedRowStyle> <AddedRowStyle CssClass="AddedRowStyle"> </AddedRowStyle> <FilterRowStyle Wrap="false"> </FilterRowStyle> <SelectedRowStyle BackColor="LightGoldenrodYellow" Font-Bold="true" /> </LayoutSettings> </ISWebGrid:WebGrid> <ISWebCombo:WebCombo ID="WebCombo1" runat="server" UseDefaultStyle="true" DataTextField="ChildDesc" DataValueField="ChildValue"> <IntegrationSettings ControlId="WebTreeView1" ControlType="WebTreeView" Enabled="true" /> </ISWebCombo:WebCombo> <ISWebTreeView:WebTreeView ID="WebTreeView1" runat="server" Height="300px" Width="250px" Style="display:none" ExpandedDepth="-1" > <NodeSettings EnableAnimation="true" /> </ISWebTreeView:WebTreeView> <ISWebCombo:WebCombo ID="wcOrigin" runat="server" UseDefaultStyle="true" DataTextField="description" DataValueField="value"> <IntegrationSettings ControlId="WebTreeView3" ControlType="WebTreeView" Enabled="true" /> </ISWebCombo:WebCombo> <ISWebTreeView:WebTreeView ID="WebTreeView3" runat="server" Height="400px" Width="250px" Style="display: none" DefaultImageHeight="48" DefaultImageWidth="48" ShowLines="False"> <NodeSettings EnableAnimation="True" /> <Nodes> <ISWebTreeView:WebTreeViewNode Name="nodeUSA" Text="USA" Selectable="False"> </ISWebTreeView:WebTreeViewNode> <ISWebTreeView:WebTreeViewNode Name="nodeForeign" Text="Foreign" Selectable="False"> </ISWebTreeView:WebTreeViewNode> </Nodes> <ImagesSettings PlusImage="./images/plus.gif" MinusImage="./images/minus.gif" /> <NodeSettings EnableAnimation="true" /> </ISWebTreeView:WebTreeView> </td> </tr> </table> code behind:protected void Page_Load(object sender, EventArgs e) { thisSession = (clsSession)Session[clsSession.SessionId];
if (!IsPostBack) { GetActionAccounts(); GetLoadedAccounts(); lblFTAcctNo.Text = thisSession.Account;
//WebGrid1.DataSource = LoadGrid(); //WebGrid1.DataBind(); } WebGrid1.DataSource = LoadGrid(); WebGrid1.DataBind(); } protected void ddlLoadedAccounts_SelectedIndexChanged(object sender, EventArgs e) { lblFTAcctNo.Text = ddlLoadedAccounts.SelectedValue; lblFTAcctNo.Text = thisSession.Account; } private DataSet LoadGrid() { returns a dataset to bind and we pass in the ddlLoadedAccounts.Selected selectedvalue to the method... }
As I Mentioned earlier the sample I attached earlier in the post is moe suited for changing datasource, both the data and the structure of the WebGrid will change. The RetrieveStructure is invoked for this very reason, the need to change the column structure of the WebGrid, the technique is derived from the WebGrid tutorial ChangeDS.aspx page.
In your case, with only the data is changing, you could use Refresh function instead of RefreshAll. This way WebGrid will not refresh the column structure.
Please modify the doChange client side function to use Refresh instead RefreshAll to solve the issue in ErrorWORetrieveStructure:
function doChange(obj) { var grid = wgGetGridById("WebGrid1"); document.all["CustomerID"].value = obj.value; grid.Refresh();}
We already have a sample for such scenario in the provided WebGrid tutorial sample. Our sample use InitializeDataSource and PrepareDataBinding server side event in order to achieve the result. Attached is the modified sample using UpdatePanel and ScriptManager. The original sample, ChangeDS.aspx, is located in the WebGrid tutorial sample under the folder V3.1
So I have changed my code to now have a WebGrid1_InitializeDataSource and WebGrid1_PrepareDataBinding added to my code. I have got it to use the AJAX updatepanel.
However, the problem I'm facing now is that Dropdownlists and WebCombos that are not displaying the data correctly. They are showing the values again versus the descriptions. When I click on the fields they are all textboxes not dropdowns or webcombos. I was using the WebGrid1_InitializeLayout section with WebValueLists. I would use the Page_Load method to load the webcombos.
Is there another place I should do this?
I took your example and made some changes. I have a dropdown of the list of customers. Select a customer and the grid fills with a list of this customer's orders. This grid has a dropdownlist (of customers) and webcombo (of employees).
When I click on cell that is the dropdownlist or webcombonet it shows the value in a text box and not the dropdownlist or webcombonet.
I know this is something with the updatepanel because when I take this same code, and comment out asp:updatepanel and contenttemplate when I click on the cell I do see the dropdownlist and webcombonet.
Any ideas?
This solved the problem with dropdowns and webcombos not showing. However, it caused another problem that was worked before this change. Now when I change values of the cells it only picks up the last value I've changed not all of the values (from different rows). I click the "Review Pending Changes" and only 1 row shows modified as well it says "1 pending change(s)" on the grid.
After testing the sample, I have reported this issue as a bug to our developer.
My test also indicate that you could refresh the grid manually after the data is loaded in order to resolve this issue.
We will inform you if there is any update or progress regarding this issue.
Can you provide the sample of how to manually refresh the grid. This is something I need asap. Does manually refreshing the grid have any underlining problems?
When will this issue be fixed? What is the time line for this?
Also on a side note is using the WebFlyPostBackManager1 better then an update panel in this case? Can you use a WebFlyPostBackManager in this situation? If so you could provide an example?
What I meant in manually refreshing the grid is the user need to manually click the refresh icon in the lower right portion of the WebGrid.
Currently I have no timeline for a fix for this issue.
Per your request, I have also try using FlyPostBackManager to subsitute the UpdatePanel. However, the issue still persist. Attached is the modified sample using FlyPostBackManager.
Is there a way we can manually refresh the grid programmically for the time being. Telling the user to refresh is not an acceptable to our clients.
Also, I did try the FlyPostBackManager but the problem with it is when you click on the EmployeeID column to edit, it refreshes the grid and blanks the data.
Hi, we have this same problem. Do you really have no estimate on how much time this fix will take?
Regarding the missing data after trying to edit the EmployeeID field, you will need to add a conditional in the ResponseSuccess to only execute the code for method "ProcessSelection".
You could try the Refresh() method to refresh the grid programatically from client side. You will need to invoke this method after the page load the first time and after the RefresfAll function is invoked in your scenario, when the data source is changed.
Regarding the ETA of the fix for this issue, currently we have no expected timeline. We will inform you if there is any update or progress regarding this fix.
Based on the analysis of our developer, this issue is not caused by a bug. In order to solve this issue, you will need to set the DataKeyField of the WebGrid RootTable after you invoke the RetrieveStructure function.
In the attached sample, that would be in the PrepareDataBinding event handler. Here is the modified snippet in the PrepareDataBinding event handler:
protected void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e){ // make sure retrievestructure is only called when the RefreshAll() is invoked from client or when the first time page load. if (WebGrid1.FlyPostBackAction == PostBackAction.RefreshAll || !IsPostBack) { // clear all grouped and sorted columns since that they are no longer exist in new datasource's structure. WebGrid1.RootTable.SortedColumns.Clear(); WebGrid1.RootTable.GroupedColumns.Clear(); // populates columns WebGrid1.RetrieveStructure(); WebGrid1.RootTable.Columns.GetNamedItem("OrderID").EditType = EditType.NoEdit; WebGrid1.RootTable.Columns.GetNamedItem("OrderID").FilterEditType = FilterEditType.TextBox; WebGrid1.RootTable.Columns.GetNamedItem("OrderID").AggregateFunction = AggregateFunctions.Count; WebGrid1.RootTable.Columns.GetNamedItem("OrderID").FooterText = "Total:"; WebGrid1.RootTable.Columns.GetNamedItem("CustomerID").EditType = EditType.DropdownList; WebGrid1.RootTable.Columns.GetNamedItem("CustomerID").FilterEditType = FilterEditType.DropdownList; WebGrid1.RootTable.Columns.GetNamedItem("EmployeeID").EditType = EditType.WebComboNET; WebGrid1.RootTable.Columns.GetNamedItem("EmployeeID").FilterEditType = FilterEditType.WebComboNET; WebGrid1.RootTable.Columns.GetNamedItem("EmployeeID").WebComboID = WebCombo1.ID; WebGrid1.RootTable.DataKeyField = "OrderID"; } //Set the valueList for the Customer WebValueList vlAssetType = WebGrid1.RootTable.Columns.GetNamedItem("CustomerID").ValueList; vlAssetType.DataSource = GetCustomers(); vlAssetType.DataValueField = "CustomerID"; vlAssetType.DataTextField = "CompanyName"; ////Set the valueList for the Employee WebValueList vlWSCSecType = WebGrid1.RootTable.Columns.GetNamedItem("EmployeeID").ValueList; vlWSCSecType.DataSource = GetEmployees(); vlWSCSecType.DataValueField = "EmployeeID"; vlWSCSecType.DataTextField = "LastName";}
Glen,
We've gone pretty deep with the question. I still find myself with problems and questions.
I'll start with my questions: Why is it needed to have RetrieveStructure() when the structure does not change only the data? So I don't understand why the "if condition" above is even needed. We have some stored procedures that cannot be modified, and by using RetrieveStructure() we are forced to use the stored procs structure.
Using RetrieveStructure I get an error on filtering. I have submitted sample for you to reproduce along with a screenshot of error under ErrorWithRetrieveStructureOnFilter.zip.
Steps for Error with ErrorWithRetrieveStructureOnFilter:1. Filter on CustomerID (Around the Horn) -->Apply Filter2. Make changes to EmployeeID3. Click the Submit button under the WebGrid1
You should see object reference not set error that is originating in PrepareDataBinding on the RetrieveStructure()
In turn because I got this error and really do not want to retrieve the structure from the database. I removed the if condition from PrepareDataBinding. I don't get the above mentioned error but I get another error when trying to make changes to a ResizableTextbox column in the grid. I have submitted a sample of this one as well with a screenshot of this error under ErrorWORetrieveStructure.zip.
Steps for Error on the reloading of different data in the grid but the SAME structure:1. Change comments column (You must change this column b/c the error doesn't happen with dropdownlists)2. Change to a different customer in the dropdownlist above the WebGrid3. Now, try to change comments you will get the error
The earlier sample is more suited for changing datasource scenario, in your case it seems you are only trying to filter the data in the WebGrid. In that case, you could try creating WebGrid filter column programmatically in order to replicate the WebGrid filter function.
This technique will also solve both of the issue you are currently facing.
Attached is the modified sample.
Glenn,
This example will not work for large data coming back like we have. Again, I need ErrorWORetrieveStructure.zip to work, that way is more efficient for our scenario.
Also you never answered the questions I had regarding why would you need to retrievestructure() when the data is changing but not the columns?
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