This is a migrated thread and some comments may be shown as answers.

RadGrid Checkbox

4 Answers 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 1
Brett asked on 21 Feb 2012, 07:44 PM

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. 

4 Answers, 1 is accepted

Sort by
0
Accepted
Richard
Top achievements
Rank 1
answered on 23 Feb 2012, 03:25 PM
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!
0
Brett
Top achievements
Rank 1
answered on 24 Feb 2012, 05:52 AM

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?


0
Princy
Top achievements
Rank 2
answered on 24 Feb 2012, 02:58 PM
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.
0
Richard
Top achievements
Rank 1
answered on 24 Feb 2012, 04:16 PM
Brett:

Take a look at the Grid / Automatic Operations Grid / 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!
Tags
Grid
Asked by
Brett
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Brett
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or