B
Ben R. Bolton
How does one display a parent field in the Child's dataGrid?
My database has two Tables, Skill, and Category. The Skill.CategoryID
column in the Skill table relates to the Category.ID field in the Category
Table.
The relation was autogenerated from an XSD:
relationCategorySkill = new DataRelation("CategorySkill", new DataColumn[]
{
this.tableCategory.IDColumn}, new DataColumn[] {
this.tableSkill.CategoryIDColumn}, false);
I am attempting to display the Skill Table in a DataGrid but instead of the
CategoryID (an int) I want to display the Category as a string. To my typed
Dataset I added a calculated column as follows:
private void AddCalculatedCategory()
{
if (jetSkillWithCategory_ds1.Skill.Columns.Contains(
Default.Name.CalculatedCategory))
return; //don't create it if it is already there.
jetSkillWithCategory_ds1.Skill.Columns.Add(
Default.Name.CalculatedCategory,
typeof(string),
"Parent.Name");
}
Unfortunately in the DataGrid I typically (not always!) get
"System.Data.DataRow" displayed in 1 or more of the rows.
Why is this happening?
Is there a better way to display the string representation in lieu of the
int?
Any help would be appreciated.
Ben
My database has two Tables, Skill, and Category. The Skill.CategoryID
column in the Skill table relates to the Category.ID field in the Category
Table.
The relation was autogenerated from an XSD:
relationCategorySkill = new DataRelation("CategorySkill", new DataColumn[]
{
this.tableCategory.IDColumn}, new DataColumn[] {
this.tableSkill.CategoryIDColumn}, false);
I am attempting to display the Skill Table in a DataGrid but instead of the
CategoryID (an int) I want to display the Category as a string. To my typed
Dataset I added a calculated column as follows:
private void AddCalculatedCategory()
{
if (jetSkillWithCategory_ds1.Skill.Columns.Contains(
Default.Name.CalculatedCategory))
return; //don't create it if it is already there.
jetSkillWithCategory_ds1.Skill.Columns.Add(
Default.Name.CalculatedCategory,
typeof(string),
"Parent.Name");
}
Unfortunately in the DataGrid I typically (not always!) get
"System.Data.DataRow" displayed in 1 or more of the rows.
Why is this happening?
Is there a better way to display the string representation in lieu of the
int?
Any help would be appreciated.
Ben