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

Custom control in multi column header error

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SCT
Top achievements
Rank 1
SCT asked on 27 Jul 2012, 12:43 PM

Hi Telerik

 We decided to use your new feature (Multi columns) in a RadGrid.

 
<telerik:GridCheckBoxColumn DataField="Image" HeaderText="Image" ColumnGroupName="Image" />

 

In our scenario we are dynamically adding controls to a header cell.

 protected void RadGridImages_ItemCreated(object sender, GridItemEventArgs e)

 {

     if (e.Item is GridHeaderItem)

     {

         GridHeaderItem headeritem = (GridHeaderItem)e.Item;

         CheckBox checkBox = new CheckBox();

         checkBox.Checked = ShowAll;

         checkBox.Text = "Show all";

         checkBox.ID = "CheckBoxShowAll";

         checkBox.AutoPostBack = true;

         checkBox.CheckedChanged += new EventHandler(checkBox _CheckedChanged);

         headeritem["ShowAll"].Text = "Show all";

         headeritem["ShowAll"].Controls.Add(checkBox);

     }

 }

 

It works perfect without using the multi columns function. However, a problem by adding a control dynamically occurs. We have obtained this error:

 “Specified argument was out of the range of valid values. Parameter name: index”

Is there any way to dynamically add control to header cell in case of using multi column function, please?

By removing the information about group and group definition, everything works perfect again. When we apply multi columns functionality and delete the functionality of dynamically control adding, everything works well too.

Thank you in advance for your advice.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 01 Aug 2012, 12:38 PM
Hello,

Can you open a formal support ticket and send us a sample project where the describe problem with RadGrid multi-column headers can be replicated? Thus we will be able to debug it locally and advice you further.

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
SCT
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or