- Home
- Forum
- ASP.NET Web Forms
- CheckBox columns always selected together
CheckBox columns always selected together
Hi,
I did a Grid now containing two CheckBox column.
When you click now on one of them in display mode the second one will also be selected.
If you change to edit mode you're also able to select single ones next to the row you're currently edeting but if course it'll not be recognize on update.
Also is there an option to multiselect rows and toggle a CheckBox for all of the selected rows?
During my study I found your sample https://asp.syncfusion.com/demos/web/grid/basicselection.aspx but can't made selection mode "Column" work for the sample - how does it work there?
<ej:Grid ID="FlatGrid" runat="server" AllowGrouping="True" AllowSorting="True" AllowResizing="true" AllowResizeToFit="true" Selectiontype="Multiple" OnServerEditRow="EditEvents_ServerEditRow">
<ClientSideEvents ActionComplete="complete" EndEdit="endEdit"
RecordDoubleClick="doubleClick" />
<%-- FlatGrid is the grid's id--%>
<Columns>
<ej:Column Field="title" HeaderText="Title" Width="240"/>
<ej:Column Field="pubDate" HeaderText="Date" AllowEditing="false" Width="120" />
<ej:Column Field="skills" HeaderText="Skills" Width="240"/>
<ej:Column Field="location" HeaderText="Location" Width="100"/>
<ej:Column Field="country" HeaderText="Country" Width="80"/>
<ej:Column Field="describtion" HeaderText="Describtion" Width="300">
<EditTemplate Create="create" Read="read" Write="write" />
</ej:Column>
<ej:Column Field="export" HeaderText="Exp" Type="checkbox" Width="50"/>
<ej:Column Field="noInterest" HeaderText="NoI" Type="checkbox" Width="50"/>
<ej:Column Field="uuid" HeaderText="UUID" Visible="false" IsPrimaryKey="true"/>
</Columns>
<EditSettings AllowEditing="True" AllowAdding="False" AllowDeleting="False"></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="edit,update,cancel"></ToolbarSettings>
</ej:Grid>
Thank you!
Andre
SIGN IN To post a reply.
1 Reply
GL
Gowri Loganathan
Syncfusion Team
March 25, 2020 02:29 PM UTC
Hi Andre,
Thanks for contacting Syncfusion Forum
Query 1 : Two CheckBox columns
From the shared code snippet we could see that you have used two type checkbox column to two fields in your grid which is not feasible , if we set like this it leads to conflict.
Please give us the below details which would be more helpful for us to proceed further
- Whether you have used any Boolean value in your dataSource to the field that has type checkbox , if yes you can use displayAsCheckBox as true instead of type checkbox.
- It is not possible to use two type checkbox columns at a time without having any boolean values that get binded in your dataSource , as type checkbox is used for selecting rows only.
Query 2 : Also is there an option to multiselect rows and toggle a CheckBox for all of the selected rows?
Yes, we can able to select/deselect the multiple row and toggle a checkbox for all the all selected rows using header column checkbox.
Kindly refer the below help documentation
Kindly refer the below screenshot
You can deselect all the selected rows with the header checkbox which is highlighted below
If we misunderstood your query kindly get back to us with video/screenshot to demonstrate the exact requirement.
Query 3 : columns selection in ejGrid
From the shared code snippet we could see that you have not defined the SelectionMode. So we suggest you to set SelectionMode as “column” in the SelectionSettings to achieve your requirement. Kindly refer the below code snippet and sample
Kindly ensure to follow the below steps in screenshot to perform column selection in your grid
Code snippet
|
. . .. .
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="true" AllowSelection="true" AllowGrouping="True" AllowSorting="True" AllowResizing="true" AllowResizeToFit="true" Selectiontype="Multiple" >
<EditSettings AllowEditing="true" AllowAdding="false" AllowDeleting="false" ></EditSettings>
<SelectionSettings SelectionMode="column"/> // for column selection
<Columns>
<ej:Column Type="checkbox" Width="50" /> // checkbox column to perform selection
<ej:Column Field="CustomerID" HeaderText="CustomerID" AllowEditing="false" Width="80" />
<ej:Column Field="ShipName" HeaderText="ShipName" Width="80">
<EditTemplate Create="create" Read="read" Write="write"/></ej:Column>
<ej:Column Field="Verified" HeaderText="Verified" Width="80" /> // Boolean column in dataSource
<ej:Column Field="ShipCountry" EditType="DropdownEdit" HeaderText="ShipCountry" Width="80" />
<ej:Column Field="OrderID" HeaderText="OrderID" IsPrimaryKey="True" Visible="false" TextAlign="Right" Width="75" />
</Columns>
</ej:Grid>
.. . . . |
Kindly refer the below sample
Kindly refer the below screenshot
Please refer the help documentation
Please get back to us if you need more assistance
Regards,
Gowri V L.
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
AN Andre
- Mar 24, 2020 12:03 PM UTC
- Mar 25, 2020 02:29 PM UTC