RadGrid Checkbox

5 posts, 1 answers
  1. Brett
    Brett avatar
    40 posts
    Member since:
    Mar 2008

    Posted 21 Feb 2012 Link to this post

    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. 

  2. Answer
    jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 23 Feb 2012 Link to this post

    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!

  3. DevCraft Release
  4. Brett
    Brett avatar
    40 posts
    Member since:
    Mar 2008

    Posted 23 Feb 2012 Link to this post

    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?


  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Feb 2012 Link to this post

    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.

  6. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 24 Feb 2012 Link to this post

    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!

Back to Top
DevCraft Release