Using 12.1 of IG and WebDataGrid
I have a grid with Grouped cells. The ungrouped columns values can be retrieved with:
string theIndividual = (string)this.WebDataGrid1.Behaviors.Activation.ActiveCell.Row.GetValue(this.WebDataGrid1.Columns["Individual_DeptAux_Department"]);
but any column inside a group such as "GroupField_2" does not return it's value. What am I doing wrong to get the value:
string theIndividual = (string)this.WebDataGrid1.Behaviors.Activation.ActiveCell.Row.GetValue(this.WebDataGrid1.Columns["Individual_LastName"]);
which is in a grouped column GroupField_2
Hi rookertrusted,
Your code is slightly off to accomplish this. Individual_LastName column is not in the grid Columns collection, but the Columns collection of GroupField_2. Try using WebDataGrid1.FindColumn("Individual_LastName"). Or get the group field from the columns collection, cast it as a GroupField, and then search in its Columns collection.
regards,
David Young
Ok, what would be the code change to this line:
to use Try using WebDataGrid1.FindColumn("Individual_LastName")?
IE... this returns no value:
string theIndividual = (string)this.WebDataGrid1.Behaviors.Activation.ActiveCell.Row.GetValue(WebDataGrid1.FindColumn("Individual_LastName"));
Hello Rookertrusted,
As David suggested you can get the group field from the columns collection, cast it as a GroupField, and then search in its Columns collection. Here is the code snippet:
GroupField fld = this.WebDataGrid1.Columns["GroupField_2"] as GroupField; String theIndividual = (string)this.WebDataGrid1.Behaviors.Activation.ActiveCell.Row.Items.FindItemByKey(fld.Columns["Individual_LastName"].Key).Value.ToString();
GroupField fld = this.WebDataGrid1.Columns["GroupField_2"] as GroupField;
String theIndividual = (string)this.WebDataGrid1.Behaviors.Activation.ActiveCell.Row.Items.FindItemByKey(fld.Columns["Individual_LastName"].Key).Value.ToString();
Please let me know if you have any further questions regarding this matter.
What namespace do I use to qualify the GroupField?
Got it:
Infragistics.Web.UI.GridControls.
Please let me know if I can provide any further assistance regarding this matter.