Hi Dheeraj,
Thanks for your description, that helped us to understand much better and was able to come up with a solution.
Previously we taught you are looking for some unbound grid acheived as I said in my previous post.
I have attached a sample which uses the steps mentioned below to acheive the beavior you mentioned.
please download the sample from the below link:
Sample illustrating checkbox in a unbound column and binding of data
Steps used in the sample:
----------------------------
a) Configuring the grid:
---------------------
We connected to the ''Nwind'' DataBase which points to the syncfusion virtual directory through code.
We fire a query on a database and fill the dataset using data adapter. and then the grid''''s datasource
is filled with the dataset and binded in Page''s Init event.
b) Adding a UnboundColumn dynamically to the grid :
------------------------------------------
You can initialize a unboundColumn and can make use of it to add in the Tabledescriptor''s column dynamically
by using the following code:
this.GridGroupingControl1.TableDescriptor.UnboundFields.Add("UnboundColumn");
this.GridGroupingControl1.TableDescriptor.Columns.Add("UnboundColumn");
this.GridGroupingControl1.TableDescriptor.VisibleColumns.Add("UnboundColumn");
c) Creating a TemplateClass implementing Itemplate Interface.
-----------------------------------------------------------
Please look in to the following kb on adding Templates through code.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=373
**d) Declare the unbound column as a templated column in Page_Init.
--------------------------------------------------------------
This is one of the important step that needs to be used for the checkbox to retain its viewstate for each postback
when we bind the grid through code by firing a query to dataset.
// you can also use any control here, this is just for defining the column as templates
// Use ''QueryCellStyleInfo'' event to add checkbox as the control.
Control ctrl=new Control();
//see the TemplateClass in code.
TemplateClass tc=new TemplateClass(ctrl);// The template class created in step c)
this.GridGroupingControl1.TableDescriptor.Columns.FindByMappingName("UnboundColumn").ItemTemplate=tc;
e) Handle ''QueryCellStyleInfo'' event to to add checkbox to each cell
-----------------------------------------------------------------
In the ''QueryCellStyleInfo'' event check for the ''UnBoundColumn'' and then apply the checkbox as a template for
each ''RecordRow''. see the sample for more info
* f) Getting the selected records when the user checks/unchecks a row on the GGC
-----------------------------------------------------------------------------
In the CheckBox''s CheckedChanged event, it is shown how to get any fields in that record for the row
in which the user clicked the checkbox.See the chkBox_CheckedChanged event in sample for moe info.
Note: In the sample we used a update button and clicking on this Update button will cause a postback
and CheckedChanged event is fired for the checkboxes whose state the user toggled.
if you want the CheckBox''s CheckedChanged event to fire for each time a checkbox state is toggled,
please make the checkbox control''s ''AUTOPOSTBACK'' property to true inside ''QUERYCELLSTYLEINFO'' event.
please look in to ''QUERYCELLSTYLEINFO'' event and also comments in sample for more info.
Once again kindly accept my apology for the delay in responding to you.
Let us know if you need more info.
Best Regards,
A.Sivakumar