C
Christopher Weaver
I'm having the hardest time doing the simplest thing.
I have a DataGrid bound to a table in a master detail DataRelation within a
DataSet
relTaskActivities = new DataRelation("TaskActivities", parentCol, childCol);
dsTaskActivities.Relations.Add(relTaskActivities);
dgActivity.SetDataBinding(dsTaskActivities, "Tasks.TaskActivities");
This works fine. I have a properly behaving master detail relationship.
But now I need to retrieve the value of a specific column in the current row
(the one selected by the user) from the detail side. I've created a
CurrencyManager to obtain the row:
cActivityMgr = (CurrencyManager)this.BindingContext[dsTaskActivities,
"Tasks.TaskActivities"];
And I've used it to select the current row:
int ThisRow = cActivityMgr.Position;
string richNote =
dsTaskActivities.Tables["Activity"].Rows[ThisRow]["Note"].ToString();
I'm getting the contents of the desired column but not the current row. It
appears to be selecting the row without regard to the master detail
relationship. How do I get the proper index of the selected row within the
grid?
Thanks.
I have a DataGrid bound to a table in a master detail DataRelation within a
DataSet
relTaskActivities = new DataRelation("TaskActivities", parentCol, childCol);
dsTaskActivities.Relations.Add(relTaskActivities);
dgActivity.SetDataBinding(dsTaskActivities, "Tasks.TaskActivities");
This works fine. I have a properly behaving master detail relationship.
But now I need to retrieve the value of a specific column in the current row
(the one selected by the user) from the detail side. I've created a
CurrencyManager to obtain the row:
cActivityMgr = (CurrencyManager)this.BindingContext[dsTaskActivities,
"Tasks.TaskActivities"];
And I've used it to select the current row:
int ThisRow = cActivityMgr.Position;
string richNote =
dsTaskActivities.Tables["Activity"].Rows[ThisRow]["Note"].ToString();
I'm getting the contents of the desired column but not the current row. It
appears to be selecting the row without regard to the master detail
relationship. How do I get the proper index of the selected row within the
grid?
Thanks.