I am currently using 11.1.20111.2020 and am experiencing an issue with using an unbound checkbox column in a WebDataGrid. When the user checks a box in a row in this column and posts back twice or more, the value is lost on the second post back. Infragistics currently has a sample in the samples section which works correctly. In my situation, the grid is bound based upon selection criteria and via a button click. It is not bound to a datasource object. The ultrawebgrid does not have this issue.
How do I persist the checked value across subsequent postbacks?
Thanks,
Hi Dev__01,
This sounds like a scenario that should work. You do have on ViewState, right? The unbound values are saved there. You have on EditingCore? This makes the checkboxes editable. Do you have on DataViewState or any other behaviors? If you were to attach some small sample here, I could check it out.
regards,David Young
Hi David - Thanks for responding. Yes the enableviewstate and enabledataviewstate properties are set to true and the editing core is enabled. I'll attach a sample momentarily.
Hi
I am also facing the same issue i did the upgrade but still behavior there; I am listing my test application it is very simple I used VS2010, framework 3.5, infragistics version 11.1.20111.2064
At my Aspx page
<
>
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px" ViewStateMode=Enabled EnableDataViewState=true>
<Columns>
<ig:UnboundCheckBoxField HeaderCheckBoxMode="TriState" HeaderChecked="False"
Key="UnboundCheckBoxField_0">
<Header Text="UnboundCheckBoxField_0" />
</ig:UnboundCheckBoxField>
<ig:UnboundField DataType="System.String" Key="Name">
<Header Text="UnboundField_0" />
</ig:UnboundField>
</Columns>
<Behaviors><ig:EditingCore></ig:EditingCore></Behaviors>
</
ig:WebDataGrid>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
At my code
protected void Page_Load(object sender, EventArgs e)
{
if
(!IsPostBack)
LoadData();
}
private void
LoadData()
DataTable table = new DataTable();
table.Columns.Add(
"Name");
table.PrimaryKey =
new DataColumn[1]{table.Columns[0]};
DataRow row = table.NewRow();
row[
"Name"] = "test";
table.Rows.Add(row);
row = table.NewRow();
"Name"] = "test2";
WebDataGrid1.DataKeyFields =
"Name";
WebDataGrid1.DataSource = table;
WebDataGrid1.DataBind();
protected void Button1_Click(object sender, EventArgs e){}
My test is i simply click the header check box now all row check boxes are seleced, i uncheck the first row and press the button to force the post back event
I was expecting to find the last row checked but nope check attached image
Sorry it took me so long to get back - we just now upgraded (To version 11.2.20112.2055).
The row updates and row additions now persist as they should. (A good thing.) However, row deletes do not appear to work. Specifically:
1. Some sample data is bound to the grid.2. The user clicks a row selector.3. The user presses the "Delete" key.4. A post-back occurs but the row is not deleted. It is still present in the grid.
I also tried deleting via javascript and the same behavior occurs.Also, when I put a break-point in the code-behind the "RowsDeleting" event is fired but the "RowDeleted" event is not fired.
In the UltraWebGrid, the row was just deleted from the grid after post-back. And in the WebDataGrid, when using AutoCRUD with a SqlDataSource, rows get deleted as they should.
Is there anything I should be doing differently?
Thanks!
Hi,
I went back and got your sample. Your sample is not quite right. You need to define a PrimaryKey on your DataTable and then a matching DataKeyFields property on the grid for us to delete the row property. dt.PrimaryKey = New DataColumn() {dt.Columns(0)}DataKeyFields="f5"Once I did this, the delete worked fine.
That makes sense. I'll test it out.
Thanks for all your help! I'll close this thread out.
We're experiencing another issue:
When the header checkbox is enabled, the following happens:
1. The user clicks the header checkbox to select all rows.2. The user clicks one or more rows' checkboxes to de-select one or more rows.3. The user posts back.4. The grid is returned with the rows that the user de-selected (unchecked the checkboxes) properly unchecked but with the rows that were supposed to be left checked now returned in a partial state.Rows that were explicitly checked or unchecked as a result of a mouse click do persist across post-backs as they should. Infragistics has an example grid that does not do this. The only difference between the Infragistics example and the project I'm working on is that mine is not bound to a datasource object. Is there something I'm missing?Thanks,