Hi, I want to change the GroupAreaText in the code behind similar like grid.GroupingSettings.EmptyGroupAreaText = "123".
How can I do this? I use the "BoundDataField" object and when I group a column I want to display the "Header.Text" value inside the "GroupAreaText"!
BR
Hello,
Thank you for posting in the Infragistics community !
I will prepare a sample for your reference that demonstrates how this can be achieved and upload it in this thread.
Please find the attached sample below. It handles the GroupedRowInitialize event to modify the default GroupedRow text. Please let me know if this meets your requirement.
Hi, on my site it is not working as expacted. Please see screenshot in the attachemnt. Do you have an idea what is wrong on my site?
I believe the text in the button should correspond to the header text set for the given column and this is how the grid behaves on my side. I was not able to reproduce this so it would be highly appreciated if you could send me an isolated sample that demonstrates this and I will investigate it for you.
Looking forward to hearing from you.
If you change your code behind this way, you will get this behaviour:
if (!IsPostBack)
{
this.WebHierarchicalDataGrid1.GridView.Columns.Clear();
this.WebHierarchicalDataGrid1.GridView.ClearDataSource();
this.WebHierarchicalDataGrid1.GroupingSettings.GroupedColumns.Clear();
BoundDataField col1 = new BoundDataField();
col1.DataFieldName = "ClaimNumber";
col1.Key = "ClaimNumber";
col1.Header.Text = "Claim Number";
this.WebHierarchicalDataGrid1.GridView.Columns.Add(col1);
BoundDataField col2 = new BoundDataField();
col2.DataFieldName = "PatientLastName";
col2.Key = "PatientLastName";
col2.Header.Text = "Patient Last Name";
this.WebHierarchicalDataGrid1.GridView.Columns.Add(col2);
BoundDataField col3 = new BoundDataField();
col3.DataFieldName = "PatientFirstName";
col3.Key = "PatientFirstName";
col3.Header.Text = "Patient First Name";
this.WebHierarchicalDataGrid1.GridView.Columns.Add(col3);
BoundDataField col4 = new BoundDataField();
col4.DataFieldName = "SSN";
col4.Key = "SSN";
col4.Header.Text = "SSN";
this.WebHierarchicalDataGrid1.GridView.Columns.Add(col4);
BoundDataField col5 = new BoundDataField();
col5.DataFieldName = "InjuryDate";
col5.Key = "InjuryDate";
col5.Header.Text = "InjuryDate";
col5.DataFormatString = "{0:dd/MM/yyyy}";
this.WebHierarchicalDataGrid1.GridView.Columns.Add(col5);
BoundDataField col6 = new BoundDataField();
col6.DataFieldName = "Value";
col6.Key = "Value";
col6.Header.Text = "Value";
this.WebHierarchicalDataGrid1.GridView.Columns.Add(col6);
}
this.WebHierarchicalDataGrid1.DataKeyFields = this.WebHierarchicalDataGrid1.GridView.Columns[0].Key;
this.WebHierarchicalDataGrid1.GridView.DataKeyFields = this.WebHierarchicalDataGrid1.GridView.Columns[0].Key;
this.WebHierarchicalDataGrid1.DataSource = GetData();
this.WebHierarchicalDataGrid1.DataBind();
this.WebHierarchicalDataGrid1.RefreshBehaviors();
//this.WebHierarchicalDataGrid1.DataSource = GetData();
//this.WebHierarchicalDataGrid1.DataBind();
HTML:
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" AutoGenerateColumns="false" StyleSetName="Ferrero"
runat="server" Height="100%" Width="100%"
OnGroupedRowInitialized="WebHierarchicalDataGrid1_GroupedRowInitialized">
<GroupingSettings EnableColumnGrouping="true"></GroupingSettings></ig:WebHierarchicalDataGrid>
Using this code I get the header text set for each column written in the buttons. For example you have set
and if I group by this column then the text I receive in the marked place on your screenshot is "InjuryDate". As mentioned this value is taken from the Header.Text property of the given column.
Please let me know if you have further questions on the issue.
Hi, here is my result:
Thank you for the screen, I have noticed the first time you attached it. I am currently working on this to see why this happens. I will keep you posted with my findings.
Hi,
I have investigated this issue, and I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 188060. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution.
I will leave this case open and update you with any new information after the review. You can also continue to send updates to this case at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
Our engineering team reviewed this issue and stated it as a correct behavior of the grid. Actually when you add columns in code behind you should add them to the WebHierarchicalDataGrid, rather than the WHDG.GridView:
BoundDataField col1 = new BoundDataField(); col1.DataFieldName = "ClaimNumber"; col1.Key = "ClaimNumber"; col1.Header.Text = "Claim Number"; this.WebHierarchicalDataGrid1.GridView.Columns.Add(col1); this.WebHierarchicalDataGrid1.Columns.Add(col1);
When the text for the element is set the code look for the columns collection of WebHierarchicalDataGrid1. However since columns were added to WebHierarchicalDataGrid1.GridView the first was empty and the Header.Text of the columns was not available, which was causing this issue.
Please correct this in your code and let me know if you have any further questions on the matter, I will be glad to help.
Hello, this code block is a suggestion from one of your colleague! Please see "Dynamical data binding" (http://www.infragistics.com/community/forums/t/92817.aspx) in your froum. I had several problems when I didn't use the GridView. BR
Thank you for your feedback !
As you notice both approaches are possible. Initially you would want to add columns to the WebHierarchicalDataGrid, as shown in the documentation:
http://help.infragistics.com/Help/Doc/ASPNET/2014.2/CLR4.0/html/WebHierarchicalDataGrid_Data_Binding.html
Of course depending on the scenario the other would be recommended, as our colleague has suggested in the "Dynamical data binding" thread. Please let me know if adding columns to the WebHierarchicalDaataGrid causes other issues in your application. If this is not the case then you are fine going for this.