Brett
Posted
on Feb 21, 2012
(permalink)
I’m trying to look for an example, but I haven’t found one. I would like to add a checkbox column to my RadGrid where if a person checks the checkbox it will do an insert into the database. This example here looks close to what I want. Where if you check the checkbox on the upper left, it will check all the rows and at the same time insert into the database as a yes/no or a 0 / 1.
Any help would be appreciated.
Thanks.
Reply
Answer
jumpstart
Master
Posted
on Feb 23, 2012
(permalink)
Brett:
Can you provide more insight into your specific requirement? Do you want to insert all of the GridDataItems in the row that contains the checkbox? Is there a primary key for the insert? Do you need to store the value of the checkbox itself, or simply read the checked property to initiate the insert of the row?
Are you binding data client-side or server-side?
You may want to take a look at the
Checkbox in Radgrid - editable without clicking on Edit button forum thread which contains one solution.
Cheers!
Reply
Brett
Posted
on Feb 23, 2012
(permalink)
Thanks, that did the trick.
The only problem I have is, is on insert/updating a record I don’t see the checkbox showing. How do I get checkbox to show when doing an insert/update?
Reply
Posted
on Feb 24, 2012
(permalink)
Hello,
I guess your CheckBox is in ItemTemplate of GridTemplateColumn. If your requirement is to show the CheckBox in edit/update form , then you need to add that in EditItemTemplate.Hope this information helps.
Thanks,
Princy.
Reply
jumpstart
Master
Posted
on Feb 24, 2012
(permalink)
Brett:
Take a look at the / Automatic Operations / Automatic Operations online demo at
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx
As Princy stated, you'd have to add an EditItemTemplate for the column with your checkbox in the same manner that's done for the "UnitPrice" column of the above demo.
Hope this helps!
Reply