Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
360
How can I get RowAdding to work with BoundCheckBoxField?
posted

Hello!

 

In my DataSource, there is a boolean property that I'm representing via a BoundCheckBoxField in my grid (whick works fine). CellEditing with the CheckBox also works, but I want to be using RowAdding, and I just can't get it work with BoundCheckBoxField at all. I can see the CheckBox in the AddNewRow but can't enter the cell, but manually setting ReadOnly to false for the Editing doesn't change it either. If I switch to BoundDataField with DataType="System.Boolean" it's working again, but I lack the nice CheckBoxes. Here is a minimal example:

 

<asp:ScriptManager runat="server" />

<ig:WebDataGrid ID="WebDataGrid1"   runat="server"   AutoGenerateColumns="False"   EnableAjax="False"   DataKeyFields="ID"   Height="350px"   Width="400px"   DataSourceID="source">

<Columns>

<ig:BoundDataField Key="Name" DataFieldName="Name" Header-Text="Name" />

<ig:BoundCheckBoxField Key="Female" DataFieldName="IsFemale" Header-Text="Female?" />

<ig:BoundDataField Key="Birthday" DataFieldName="Birthday" Header-Text="Birthday" DataType="System.DateTime" />

</Columns> <Behaviors>

<ig:EditingCore Enabled="true" BatchUpdating="true">

<Behaviors>

<ig:RowAdding Alignment="Top" Enabled="true" />

<ig:CellEditing Enabled="true" />

</Behaviors>

</ig:EditingCore>

</Behaviors>

</ig:WebDataGrid>

<asp:ObjectDataSource ID="source" TypeName="WebApplication2.Source" SelectMethod="GetData" runat="server" />  

 

The code for the DataSource is:

 

namespace WebApplication2

{

public class Source

{

public IList GetData()

{

 return new List<Person>() { new Person { ID = 1, Birthday = DateTime.Now, Name = "Me", IsFemale = false } };

}

}

 public class Person

{

public int ID { get; set; }

public DateTime Birthday { get; set; }

public string Name { get; set; }

public bool IsFemale { get; set; } } }

 

Thanks in advance for any help getting this to work (if it's possible) with CheckBoxes!

 

PS: This time I decided to use CellEditing, but when I tried RowEditing, as soon as I enter a row with a BoundCheckBoxField inside, the state of the CheckBox is not saved (it's always Unchecked when in RowEditing mode, but reverts to its initial state on "Done" if I didn't touch it).

Parents Reply Children
No Data