Version: 11.1.20111.2238
Hello,
I have a WebDataGrid in an UpdatePanel. If I select a row and this fires a RowSelectionChanged event the CustomSummary in the SummaryRow disappears (the cell is empty then).If I add standard column summaries they stay, only custom summaries are lost (also with EnableViewState="true").
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <ig:WebDataGrid ID="wdg1" runat="server" EnableAjax="false" EnableDataViewState="true"> <Behaviors> <ig:Selection CellClickAction="Row" RowSelectType="Single"> <AutoPostBackFlags RowSelectionChanged="true" /> </ig:Selection> <ig:SummaryRow ShowSummariesButtons="False" FormatString="{1}" CompactRendering="On" EmptyFooterText="" Enabled="true"> <ColumnSummaries> <ig:ColumnSummaryInfo ColumnKey="Avg1"> <Summaries> <ig:Summary SummaryType="Custom" CustomSummaryName="Avg1" /> </Summaries> </ig:ColumnSummaryInfo> </ColumnSummaries> <ColumnSettings> <ig:SummaryRowSetting ColumnKey="Avg1" ShowSummaryButton="false"> <SummarySettings> <ig:SummarySetting SummaryType="Custom" CustomSummaryName= "Avg1" FormatString="{1:##.#0}" /> </SummarySettings> </ig:SummaryRowSetting> </ColumnSettings> </ig:SummaryRow> </Behaviors> </ig:WebDataGrid> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="butUpdate" EventName="Click" /> </Triggers></asp:UpdatePanel>
Regards,Andreas
Hello Andreas
I have made a sample based on your code snippet but I am unable to reproduce the issue with the pointed from you version. I have tested the sample with IE 9 and Chrome latest. I am using for custom summary just DateTime.Now. Can you please modify the sample to reproduce the issue or if it is not necessary provide steps to reproduce and browser + version if you are using a different one.
Hello Andreas,Please let me know if you have any further questions regarding this issue.
Hello Nikifor,
I just found the difference between your example and what I am doing. You are rebinding the datasource on each postback in Page_Load.
If you change your code to:protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { wdg1.DataSource = MakeTable(); }}and modify your WebDataGrid with EnableDataViewState="true" you will see the problem. If you send a postback the grid will keep everything but the custom summary.I was not aware that I always need to rebind the data for the custom summary to work. Is this the expected behaviour? I would have expected that it is stored in ViewState or DataViewState together with the other summaries and all the rest of the information.
Hello Andreas,
Yes the standard summaries are persisted but the custom generated one are expected to be calculated again every time. It would be a nice practive to keep datasources in the session since they are manually changing it only in CRUD events.
it takes quite some time to create the dataset used for the grid, so I need to put the data in a session variable handled in page_load.The confusion was caused by the fact that standard summaries are kept on postback, only custom summaries are not.Thanks.
Andreas
Hello Andeas,If you debug the website you will notice that every time when the grid is making a postback it hits page load and there the datasource is null because you are setting it dynamically and it is not kept. It is good every time to set the datasource in page load and if it is datatable to keep the datasource in a session variable. What is the reason to use DataViewState? When you make a postback the grid is not bound again to receive its datasource and to calculate the custom summary and the event is not fired. The DataviewState is not persisting the summary.