I would like to change the GroupPanel Text. Currently it says, "Drag a column here to group by that column.". I would like it to say something else.
Can someone please assist.
Thanks,
Vance
9 Answers, 1 is accepted
Try the following code snippet to achieve your scenario.
C#:
this
.radGridView1.TableElement.GridViewElement.GroupPanelElement.Text =
"some text"
;
Hope this helps.
Regards,
Princy.
Thank you Princy for provided help.
The provided code is correct. Just for your information, the GridViewElement can be accessed directly through the control as well:
this
.radGridView1.GridViewElement.GroupPanelElement.Text =
"Your Custom text 1"
;
Also, you need to handle the case when user clears the groups, because the grid will reset the text to the default one. This can be achieved by subscribing to the GroupByChanged event:
void
radGridView1_GroupByChanged(
object
sender, GridViewCollectionChangedEventArgs e)
{
if
(e.GridViewTemplate.GroupDescriptors.Count == 0)
{
this
.radGridView1.GridViewElement.GroupPanelElement.Text =
"Your Custom text 1"
;
}
}
This topic is also discussed in the following forum thread: http://www.telerik.com/community/forums/winforms/gridview/radgridlocalizationprovider-custom-groupingpaneldefaultmessage.aspx
I hope this helps.
All the best,
Anton
the Telerik team
I want to change the height of GroupPanelElement by changing the height value in
this.radGridView1.GridViewElement.GroupPanelElement.Size = new Size(this.radGridView1.Width, 200);
nothing would be happened and value came back to 23 which is set for it as a default value​.
What should I do?
Best regards,
Faqriba
Thank you for writing.
Instead of setting the Size property, you can set the MinSize property to increase the group panel's height:
this
.radGridView1.GridViewElement.GroupPanelElement.MinSize =
new
Size(
this
.radGridView1.Width, 200);
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik
Dear dess
yes It works
Thank You
So this works.
DGVToolNotes.GridViewElement.GroupPanelElement.MinSize = new Size(DGVToolNotes.Width, 50);
But I can't seem to get this to work below.
this.DGVToolNotes.GridViewElement.GroupPanelElement.Text = "test this string";
private void DGVToolNotes_GroupByChanged(object sender, GridViewCollectionChangedEventArgs e)
{
if (e.GridViewTemplate.GroupDescriptors.Count == 0)
{
this.DGVToolNotes.GridViewElement.GroupPanelElement.Text = "testing this shit";
}
}
Also, anyone know how to change the Font of this string?
MG
Note that by default the group panel will show the specified text only when no grouping is available. Once you group the grid, the text is hidden. I suppose that you set the GridViewElement.GroupPanelElement.Text property in the form's constructor. If you set it in the Load event, the desired text will be displayed. As to the font, it is necessary to set just the GroupPanelElement.Font property:
private
void
RadForm1_Load(
object
sender, EventArgs e)
{
this
.radGridView1.GridViewElement.GroupPanelElement.Text =
"test this string"
;
this
.radGridView1.GridViewElement.GroupPanelElement.Font =
new
Font(
"Arial"
, 12f, FontStyle.Italic);
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik
HI Dess,
this worked half way. GroupPanelElement.Font worked, but the GroupPanelElement.Text didn't.
Strange. See screen cap attached.
private void newTablePanel_Load(object sender, EventArgs e)
{
this.myDataTable.GridViewElement.GroupPanelElement.Text = "test this string";
this.myDataTable.GridViewElement.GroupPanelElement.Font = new Font("Calibri", 30f, FontStyle.Italic | FontStyle.Bold | FontStyle.Underline);
}
MG
If you set the GroupPanelElement.Text property in the Form.Load event it is supposed to work as expected. I have attached my sample project for your reference. If you are still experiencing any further difficulties, feel free to modify the project in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik