View Full Version : [CLOSED] Checkbox in Gridview

Oct 03, 2008, 5:32 PM
Hi, everybody!
This is my first post here!

I'm having some problems to implement a checkbox inside a gridview.

My scenario is this:

I have a grid, inside this grid I have some informations (brief description) of an event.
I want to enable people select wich event they want (one or more than one).

For this, I constructed an Grid with RowExpander.
To select each event, I tried it in tree ways:

1st: I added the checkbox selection model <ext:CheckboxSelectionModel>
But, in this case, its add an "master" checkbox to select all rows, and I dont want it.
Question: can I disable this "check all" checkbox?
Question: How I can add database values (record_id field) to this checkbox?
Example: http://www.fsba.edu.br/semanaacademica/inscricao/ext.aspx

2nd: I removed the checkboxSelectionModel and added <ext:RowSelectionModel>
In this case, i added an checkboxcolum in my gridview. But all checkbox came checked and te user can't uncheck or check it (cant change state).
Question: How can I enable user check/uncheck checkbox?
Question: How I can add database values (record_id field) to this checkbox?
Example: http://www.fsba.edu.br/semanaacademica/inscricao/ext2.aspx

3rd: Still in <ext:RowSelectionModel> and removed the checkboxcolum
In this way, i tryed to put an checkbox inside a expander, like this:

<Template ID="Template1" runat="server">
<div style="padding-left:40px">
<p>Ementa: {ementa}</p>
<p>Local: {local}</p>
<p>Das{hora_inicio} às {hora_fim}</p>

<ext:Checkbox runat="server" />


But, when I run the page: Parser Error Message: The 'Text' property of 'Template' does not allow child objects.

Any ideas? Can someone help-me?


Oct 06, 2008, 5:32 AM
Hi caiomarques,

Thanks for your post.

1.  Question: can I disable this "check all" checkbox?
     I have added HideCheckAll property to v0.7.0 For now you can use next technic

    //add this style to your page
    <style type="text/css">
         .x-grid3-hd-checker{background: transparent !important;}

   //and set next Header for CheckBoxSelectionModel

2. Question: How can I enable user check/uncheck checkbox?
    Yes, the editing functionality was missing in CheckColumn. It added in v0.7.0 (just set Editable property of CheckColumn to true)

3. The Template can't contains any server-side controls (at least now). You can play with template adding html markup (for excample, <input type='text'> and etc)

4. How I can add database values (record_id field) to this checkbox?
    Can you clarify this? You can set ReaderID in Reader and this field will be associated with record. Also the CheckBoxSelectionModel (and also the RowSelectionModel) contains information about selected rows (http://examples1.ext.net/#/GridPanel/Selection_Models/Checkbox_Selection/).

Oct 06, 2008, 12:16 PM
Vladimir, thank u so much for your help!

About 4. How I can add database values (record_id field) to this checkbox?


In my database, i have the record id. My sql statatement is like this

Select id_curso,nome, tipo_curso,data,hora_inicio,hora_fim,local,ementa from my_table

I want to atach this value[id_curso] (from database) to a line or checkbox in the


Can I do this?

<ext:Store ID="Store1" runat="server">




<ext:RecordField Name="id_curso" />

<ext:RecordField Name="nome" />

<ext:RecordField Name="tipo_curso"/>

<ext:RecordField Name="data" Type="Date" />

<ext:RecordField Name="hora_inicio" Type="Date"/>

<ext:RecordField Name="hora_fim" Type="Date"/>

<ext:RecordField Name="local"/>

<ext:RecordField Name="ementa"/>





<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Title="Semana Acadêmica" Frame="true" Height="600" TrackMouseOver="true" StripeRows="true">

Oct 06, 2008, 12:45 PM
You can set id field in reader

<ext:JsonReader ReaderID="id_curso" >

Then on server side (on postback or AjaxEvent) you can check what rows selected

CheckBoxSelectionModel sm = this.GridPanel1.SelectionModel.Primary as CheckBoxSelectionModel;

foreach (SelectedRow row in sm.SelectedRows)
// use row.RecordID

Oct 06, 2008, 4:34 PM
Thanks, Vladimir!