Hi,
We have found the following behavior with Web Grid, and want to confirm if the same is a bug.
Created an Unbound column of CheckBox Type, and placed a 'Test Postback' on the page (outside the WebGrid).
Check one or more Check Boxes
Click 'Test Postback'
It works fine for the first postback.
User sees Check Boxes selected still.
Click 'Test Postback' again
This empties unchecks all Check Boxes in the Column.
Can somebody tell me if this behavior is by design or is a bug?
Also, is there any solution as we need to keep the CheckBox selection as is across all postbacks (Except converting the unbound column to a bound column and preserving its state in source data object).
Regards,
MPVBRao.
Did you add the unbound column in code or in the designer?
If you added the column in code, how did you do it? It's possible that the column isn't being stored in ViewState. Depending on how you created the column object, this might be an expected result. The following post provides more details on this behavior, and how to get around it:https://es.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/52172/ultracombo-with-dropdownlist-style-has-missing-borders#52172
It is defined in design as given below,
<igtbl:UltraGridColumn Key="Select" Type="CheckBox" DataType="System.Boolean" Width="1%"
AllowUpdate="Yes">
<Header Caption="Select">
<RowLayoutColumnInfo OriginX="7" />
</Header>
<Footer>
</Footer>
</igtbl:UltraGridColumn>
Thanks & Regards,
No, there is no databind statement, as I am handling InitializeDataSource event
Thanks for the quick response.
Here is the complete code that reproduces the behavior.
Default.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<%@ Register Assembly="Infragistics35.WebUI.UltraWebGrid.v8.3, Version=8.3.20083.2021, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" @%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<igtbl:UltraWebGrid ID="samplesListView" runat="server" Height="90%" Width="100%">
<DisplayLayout AutoGenerateColumns="false" ViewType="Flat" AllowColSizingDefault="Free"
AllowColumnMovingDefault="OnServer" AllowDeleteDefault="Yes" AllowSortingDefault="Yes"
AllowUpdateDefault="Yes" BorderCollapseDefault="Separate" HeaderClickActionDefault="SortMulti"
Name="UltraWebGrid1" RowHeightDefault="20px" RowSelectorsDefault="No" SelectTypeRowDefault="Extended"
StationaryMargins="No" StationaryMarginsOutlookGroupBy="True" TableLayout="Fixed"
Version="4.00">
<FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Height="90%"
Width="100%">
</FrameStyle>
<Pager MinimumPagesForDisplay="1" PageSize="4" AllowPaging="true" PagerAppearance="Both"
StyleMode="QuickPages" QuickPages="5">
<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
</PagerStyle>
</Pager>
<EditCellStyleDefault BorderStyle="None" BorderWidth="0px">
</EditCellStyleDefault>
<FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
</FooterStyleDefault>
<HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid" HorizontalAlign="Left">
</HeaderStyleDefault>
<RowStyleDefault BackColor="Window" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Microsoft Sans Serif" Font-Size="8.25pt">
<Padding Left="3px" />
<BorderDetails ColorLeft="Window" ColorTop="Window" />
</RowStyleDefault>
<GroupByRowStyleDefault BackColor="Control" BorderColor="Window">
</GroupByRowStyleDefault>
<GroupByBox>
<BoxStyle BackColor="ActiveBorder" BorderColor="Window">
</BoxStyle>
</GroupByBox>
<AddNewBox Hidden="False">
<BoxStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid" BorderWidth="1px">
</AddNewBox>
<ActivationObject BorderColor="" BorderWidth="">
</ActivationObject>
<FilterOptionsDefault FilterUIType="FilterRow" AllowRowFiltering="OnServer" RowFilterMode="AllRowsInBand">
<FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"
Font-Size="11px" Height="300px" Width="200px">
<Padding Left="2px" />
</FilterDropDownStyle>
<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
</FilterHighlightRowStyle>
<FilterOperandDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid"
BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"
Font-Size="11px">
</FilterOperandDropDownStyle>
</FilterOptionsDefault>
</DisplayLayout>
<Bands>
<igtbl:UltraGridBand DataKeyField="CompleteSampleNo">
<Columns>
<igtbl:TemplatedColumn Width="1%">
<Header Caption="Action">
<CellTemplate>
<asp:LinkButton ID="testLinkButton1" runat="server" Text="Test DataKey" CommandName="test1"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "CompleteSampleNo") %>' />
|
<asp:LinkButton ID="testLinkButton2" runat="server" Text="Test CommandArgument" CommandName="test2"
</CellTemplate>
</igtbl:TemplatedColumn>
<igtbl:UltraGridColumn Key="CompleteSampleNo" BaseColumnName="CompleteSampleNo" Width="1%">
<Header Caption="Sample No.">
<RowLayoutColumnInfo OriginX="1"></RowLayoutColumnInfo>
</Columns>
<AddNewRow View="NotSet" Visible="NotSet">
</AddNewRow>
</igtbl:UltraGridBand>
</Bands>
</igtbl:UltraWebGrid>
<asp:Button ID="testPostback" runat="server" Text="Test Postback" />
</div>
</form>
</body>
</html>
Default.ASPX.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Infragistics.WebUI.UltraWebGrid;
using System.Configuration;
using System.Data;
using System.IO;
public partial class Default : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
this.samplesListView.InitializeDataSource += new InitializeDataSourceEventHandler(samplesListView_InitializeDataSource);
}
public class Sample
public int Batch { get; set; }
public int SampleNumber { get; set; }
public string CompleteSampleNo
get
return string.Format("{0}-{1}", this.Batch, this.SampleNumber);
private void AddSamples(List<Sample> samplesList, int batch, int numberOfSamples)
for (int i = 1; i <= numberOfSamples; i++)
samplesList.Add(new Sample() { Batch = batch, SampleNumber = i });
void samplesListView_InitializeDataSource(object sender, UltraGridEventArgs e)
//prepare some dummy data for the grid
var batchesList = new List<Sample>();
AddSamples(batchesList, 112333, 4);
AddSamples(batchesList, 112334, 3);
AddSamples(batchesList, 112335, 1);
AddSamples(batchesList, 112336, 4);
samplesListView.DataSource = batchesList;
Since you're using the InitializeDataSource event, the grid is implicitly calling DataBind() on every postback. Since you're not persisting the value in these checkboxes in any way, they're lost on the postback that occurs after the postback where they were changed.
I see two options. One is to persist the value of the checkbox on each row in some fashion. The other is to not use the InitializeDataSource event, and thus take direct control as to when you call the grid's DataBind() event.
Ok, I will try to persist the state.
Also could you please explain the below.
Why is the grid showing wrong checkbox state after first postback?, as the same state is not accessible though code in the next postback.
mpvbrao said:Also could you please explain the below. Why is the grid showing wrong checkbox state after first postback?, as the same state is not accessible though code in the next postback
Why is the grid showing wrong checkbox state after first postback?, as the same state is not accessible though code in the next postback
By persisting the state of the checkboxes, restoring them in either InitializeDataSource or InitializeLayout, you'll ensure that the checkboxes remain checked even after subsequent postbacks.
If you instead chose to not use InitializeDataSource, and so long as ViewState is enabled for the grid, the state of the checkboxes would be retrieved from ViewState. So long as you don't DataBind the grid again, the states will persist across multiple postbacks.
Vince McDonald"]There's no event processed this time, since the user didn't change any of the states of the checkboxes.
But how does it know that there are no changes at this time, as the previous stateof checkboxes is not maintained anywhere.
Whatever the case, user should see the same which the developer could access in the postback, but in this case end user is shown false state than what is actually available to the developer, am I right?.
I see two options. One is to persist the value of the checkbox on each row in some fashion. The other is to not use the InitializeDataSource event, and thus take direct control as to when you call the grid's DataBind() event."
so, which event do we have access to the datagrid rows and its values before InitializeDataSource is called to rebind to persist value of the checkbox?
The below is the conversation on the support case I opened regarding this issue.
Support Request CAS-14180-IB3NB9
Your case has been closed.
If you feel that your issue is still not resolved, you can reopen this case within the next 30 days, using the "Reopen" button when viewing this case at the "My Support Requests" page of our website.
After 30 days, the case cannot be reopened. If you need further assistance after this timeframe, please submit a new support request, and refer to this case number.
Please take a moment to provide feedback to Infragistics regarding the quality of support you have received regarding this case, using the following web page:
http://www.zoomerang.com/survey.zgi?p=WEB2282WD5HGKE
Hello,
Thank you for getting back with an update on the issue. From the description of the issue it seems that you want to get the status of the checkbox even after postback.
I would request you to please save the state to any variable or hiddenField so that it can be latter on reset and you can retrieve it.
This is the expected behavior and in order to get the state you would have to save it.
You can refer the online help articles that I have provided in the last reply.
I apologize for the inconvenience that this might cause you.
Sincerely,GauravDeveloper Support Engineer
Thank you for submitting your issue with Infragistics Developer Support.
From the description of the issue and the forum link that you have prvided it seems that the checkbox state in the unbound column in WebGrid is getting lost after the second postback and also you are not getting the checked state after the first postback however, they appear checked.
I would like to inform you that this is a known issue. As you have the Unbound checkbox column in the WebGrid it keeps state checked because of the viewstate property but it is only for the display purpose. But if you again do a postback then it would not get the checkboxes as checked because before second postback you have not changed the state.
Now if you want that the state should persist across numerous postbacks then you would have to save the modified state of the checkbox either to the database or to any other data source from where you can again maintain the state.
For updating you can refer the following knowledge base article:
<http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=1104&_ga=2.147349239.1913332359.1564406253-1977778533.1538057382><http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=3455&_ga=2.147349239.1913332359.1564406253-1977778533.1538057382><http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=5937&_ga=2.147349239.1913332359.1564406253-1977778533.1538057382>
Hope this will help you.
This case has been submitted as a trial case. While we will naturally get to this as quickly as possible, we are sure you understand that our priorities are first to paid priority support customers, then to paid customers, and then to trial customers. We know that once you are finished evaluating our product(s), and become a paying customer, you will appreciate the order in which we have set these priorities.
If you have a license key, please register it to your Infragistics member profile at the following page:
<http://devcenter.infragistics.com/Support/KnowledgeBase.Aspx?_ga=2.147349239.1913332359.1564406253-1977778533.1538057382>
Once you have registered your license key, future support requests you submit for the corresponding version of the product will be connected to the appropriate level of support for that license.
If you are unable to register your license key for some reason, such as that it is already registered to another user, please contact our Registrations department at the following email address: registrations@infragistics.com
Checkbox state is being lost in second Postback.
We have a grid for which InitializeDataSource event is handled,
It contains an unbound editable checkbox column.
When user selects one or more checkboxes in the column and clicks a button to postback, it work fine for the first time and displays the checkboxes checked properly.
When user click the button postback again, the resulting screen clears the checkboxes, and through code also we are unable to get its checked state as shown before the second postback.
Also please refer to 'Steps to Reproduce'
Could you tell me if this behavior is by design or is a bug?
Reference: https://es.infragistics.com/community/forums/f/ultimate-ui-for-asp-net/67715/ultrawebgrid-checkbox-event-problem#67715
As said by Vince McDonald on the above forum thread, if the grid is rebinding in every postback (as we are handling InitializeDataSource event), it has to empty checkboxes even for the first time too, but it is persisting values for the first, not persisting there on.
Could you tell me if this behavior is by design or is a bug?, and any fix if available.
A sample page to reproduce the behavior is attached.
Thanks for the update.
I raised a support case for this, and will post the complete conversation here once it gets resolved.
I have double checked this problem with development and this is considered not a bug. Depending on your scenario (I am assuming you are using InitializeDataSource event) you may need to persist manually (with code) the values of the checkboxes - this can be for example ArrayList or List of boolean values in Session / Cache / ViewState and then restore, since databinding essentially clears grid row data.
I think Vince described that best with this
<quote>
"Since you're using the InitializeDataSource event, the grid is implicitly calling DataBind() on every postback. Since you're not persisting the value in these checkboxes in any way, they're lost on the postback that occurs after the postback where they were changed. I see two options. One is to persist the value of the checkbox on each row in some fashion. The other is to not use the InitializeDataSource event, and thus take direct control as to when you call the grid's DataBind() event."
</quote>
I have the same problem in my project. Any solution yet?
Regards
Bjarte Karlsen
CEO iSentio AS.