17 Answers, 1 is accepted
Thank you for writing.
The same scenario is easily achievable with our controls for win forms. Please find attached a sample project where I have implemented a similar column header cell in the RadGridView. What I have done is create a custom header cell element and replaced the original one in the RadGridView CreateCell. I have also increased the RadGridView header row height so it could accommodate the additional elements.
I hope this is what you are looking for. If you have further questions, I would be glad to help.
Ivan Petrov
the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

I have used your code but users have found another problem ...
If there is horizontal scrollbar on grid, and if You scroll/move grid, header buttons are displayed in random columns.
Just use existing example add more columns and set width to it so whole grid is longer than window and horizontal scoll bar is shown.
Now move scroll bar left and right and hopefully You will see a problem with buttons :)
Is there any solution for that ?
Thank you for writing.
This behavior is due to the UI virtualization of RadGridView. To avoid such cases you will need a custom column which will use your custom header cell. I have attached a modified version of the example where I have implemented such a column.
I hope this will be useful. Should you have further questions, I would be glad to assist.
Greetings,
Ivan Petrov
the Telerik team

Thank You !:)

I tried the same thing but with a single dropdown box in the header.
The thing works so far but when I scroll left right, the selected index of every single dropdown box jumps around. Is there a way to make this work? So that I can select for every header a certain value from a dropdown box (all the boxes have the same choices).
As I said, I could already get the initialize the dropdown lists. the only problem is the GUI behavior.
have a nice day
Oliver Bernhardt
[EDIT]: Also, some times the header text alignment jumps from MiddleTop to MiddleCenter.
Thank you for writing.
The problem you have there has to do with the UI virtualization of RadGridView. When you scroll left and right the visual cells are reused and only the data they display is changed. This requires two components. The first is a UI element that will display the data to the user. You have that in the custom header cell. The second component is the actual data the cell will be displaying. Here is where your implementation needs some improvement. You do not save the selection in the drop down list anywhere. I have attached a sample project where the drop down value is stored in the column's Tag property. This acts as your data component and when you scroll the UI virtualization works properly.
I hope this will help. Do not hesitate to write back with further questions.
Regards,
Ivan Petrov
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

Thank you very much for your help. It took me some time to adjust your code for my personal needs but it works great now.
Have a nice day
Oliver Bernhardt

Thanks!
Thank you for writing.
Are you sure that you have downloaded the right example project? I have tested with this one and everything is working as expected.
I am additionally sending you a gif showing how the grid behaves on my side.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Thank you for writing.
You create event handler inside the custom header cell element and expose it so that you can subscribe to it. The following KB resource handles a similar scenario in the RadTextBox control: http://www.telerik.com/support/kb/winforms/details/search-box.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik

Hi Hristo ,
i tried your idea , but i have a problem now
that event handler is null.
public delegate void ActionButtonsClick(object sender, object action);
public event ActionButtonsClick OnButtonClicked;
void button1_Click(object sender, EventArgs e)
{
if(this.OnButtonClicked!=null)
{
this.OnButtonClicked(sender, "sum");
}
}
and on form1.cs
void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
if (e.Column.Name == "Decimal" && e.CellType == typeof(GridHeaderCellElement))
{
e.CellType = typeof(MyHeaderCellElement);
(e.CellElement as MyHeaderCellElement).OnButtonClicked += Form1_OnButtonClicked;
}
}
and event not fired any more
any ideas please ?
Thank you for writing back.
You need to raise the event from within the custom header cell and handle it in your form. I am sending you attached a sample project which should get you going.
I hope this helps. Please let me know if you need further assistance.
Regards,
Hristo Merdjanov
Telerik

Hi,
Is it possible to get the text of the textbox in the gridview from the form? Let's say the textbox has a value, and if I click on one button outside the gridview or press a key combination, I want to copy the value of the textbox in another textbox in the form outside the grid.
ThanksThank you for writing.
You can accomplish your task by defining a property in the custom HeaderCellElement exposing the RadTextBoxElement. You will also need to store the header cell you create in the form to a variable which can be accessed and via the property and the value of the text box read.
I hope this helps. Please let me know if you need further assistance.
Regards,
Hristo Merdjanov
Telerik by Progress

Thank you for writing back.
Alternatively, to the suggested approach, you can subscribe to the TextChanged event of the TextBoxElement and raise an event in your form. This way on a form level you will be notified every time the text changes. You can choose the one which suits you best.
I hope this helps. Please let me know if you need further assistance.
Regards,
Hristo Merdjanov
Telerik by Progress