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. 8 2027
Hi,
inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager
:
DataRowView activityDRV =
(DataRowView)this.BindingContext[dsTaskActivities,
"Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH,
greeetings 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.
Hi,
inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager
:
DataRowView activityDRV =
(DataRowView)this.BindingContext[dsTaskActivities,
"Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH,
greeetings 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.
Thanks for writing back, but I must say that I've never read a more terse or
vague response. Nevertheless, I scratched my head for a while a concluded
that the only possible meaning that I could attribute to your answer in the
context of my question was that the grid itself must have the properties I'm
looking for.
I looked again at the DataGrid in the help system and realized that I had
been looking at the wrong entry. What a difference a few properties can
make.
For anyone listening in the working code looks like this:
int ThisRow = dgActivity.CurrentRowIndex;
string richNote = dgActivity[ThisRow, 1].ToString();
Where 1 is the index of the column I'm looking for.
"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager :
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH, greeetings
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.
Thanks for writing back, but I must say that I've never read a more terse or
vague response. Nevertheless, I scratched my head for a while a concluded
that the only possible meaning that I could attribute to your answer in the
context of my question was that the grid itself must have the properties I'm
looking for.
I looked again at the DataGrid in the help system and realized that I had
been looking at the wrong entry. What a difference a few properties can
make.
For anyone listening in the working code looks like this:
int ThisRow = dgActivity.CurrentRowIndex;
string richNote = dgActivity[ThisRow, 1].ToString();
Where 1 is the index of the column I'm looking for.
"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager :
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH, greeetings
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.
Hi,
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:uC**************@TK2MSFTNGP10.phx.gbl... Thanks for writing back, but I must say that I've never read a more terse or vague response.
What's so vague about it, i mean you yourself said you can get the position
out of a CurrencyManager, but the position didn't match the DataTable,
because a grid is never directly bound to a DataTable or DataSet but to a
DataView.
Then i said, you can directly get the current DataRowView from the
CurrencyManager like this:
DataRowView activityDRV =
(DataRowView)this.BindingContext[dsTaskActivities,
"Tasks.TaskActivities"].Current;
Once you have the current DataRowView you can get the value for an
individual cell, like:
string richNote = (string)activityDRV["Note"];
I don't know what more i could have told you.
Nevertheless, I scratched my head for a while a concluded that the only possible meaning that I could attribute to your answer in the context of my question was that the grid itself must have the properties I'm looking for.
Really ? All i said was that the CurrencyManager keeps the current row
which happens to be a DataRowView. I looked again at the DataGrid in the help system and realized that I had been looking at the wrong entry. What a difference a few properties can make.
For anyone listening in the working code looks like this:
int ThisRow = dgActivity.CurrentRowIndex; string richNote = dgActivity[ThisRow, 1].ToString();
The way i showed you works, but if you prefer the above, no problem, it's
just another way. Where 1 is the index of the column I'm looking for.
"Bart Mermuys" <bm*************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager :
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH, greeetings
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.
Hi,
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:uC**************@TK2MSFTNGP10.phx.gbl... Thanks for writing back, but I must say that I've never read a more terse or vague response.
What's so vague about it, i mean you yourself said you can get the position
out of a CurrencyManager, but the position didn't match the DataTable,
because a grid is never directly bound to a DataTable or DataSet but to a
DataView.
Then i said, you can directly get the current DataRowView from the
CurrencyManager like this:
DataRowView activityDRV =
(DataRowView)this.BindingContext[dsTaskActivities,
"Tasks.TaskActivities"].Current;
Once you have the current DataRowView you can get the value for an
individual cell, like:
string richNote = (string)activityDRV["Note"];
I don't know what more i could have told you.
Nevertheless, I scratched my head for a while a concluded that the only possible meaning that I could attribute to your answer in the context of my question was that the grid itself must have the properties I'm looking for.
Really ? All i said was that the CurrencyManager keeps the current row
which happens to be a DataRowView. I looked again at the DataGrid in the help system and realized that I had been looking at the wrong entry. What a difference a few properties can make.
For anyone listening in the working code looks like this:
int ThisRow = dgActivity.CurrentRowIndex; string richNote = dgActivity[ThisRow, 1].ToString();
The way i showed you works, but if you prefer the above, no problem, it's
just another way. Where 1 is the index of the column I'm looking for.
"Bart Mermuys" <bm*************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager :
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH, greeetings
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.
My Dear Friend,
I am laughing out loud right now. I didn't read your entire post! At the
top you wrote 'Hi, inline.' and I took that to be your response --- all of
your response.
Having just read the rest of what you posted, I must say there was nothing
vague about it at all. Thank you again for your help! And I promise to
never fail to read an entire post!
Christopher Weaver
"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:Of**************@TK2MSFTNGP14.phx.gbl... Hi,
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:uC**************@TK2MSFTNGP10.phx.gbl... Thanks for writing back, but I must say that I've never read a more terse or vague response.
What's so vague about it, i mean you yourself said you can get the position out of a CurrencyManager, but the position didn't match the DataTable, because a grid is never directly bound to a DataTable or DataSet but to a DataView.
Then i said, you can directly get the current DataRowView from the CurrencyManager like this:
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
Once you have the current DataRowView you can get the value for an individual cell, like:
string richNote = (string)activityDRV["Note"];
I don't know what more i could have told you.
Nevertheless, I scratched my head for a while a concluded that the only possible meaning that I could attribute to your answer in the context of my question was that the grid itself must have the properties I'm looking for.
Really ? All i said was that the CurrencyManager keeps the current row which happens to be a DataRowView.
I looked again at the DataGrid in the help system and realized that I had been looking at the wrong entry. What a difference a few properties can make.
For anyone listening in the working code looks like this:
int ThisRow = dgActivity.CurrentRowIndex; string richNote = dgActivity[ThisRow, 1].ToString();
The way i showed you works, but if you prefer the above, no problem, it's just another way.
Where 1 is the index of the column I'm looking for.
"Bart Mermuys" <bm*************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl... 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();
You can get the selected row (DataRowView) directly from the CurrencyManager :
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH, greeetings
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.
Hi,
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... My Dear Friend,
I am laughing out loud right now. I didn't read your entire post! At the top you wrote 'Hi, inline.' and I took that to be your response --- all of your response.
Yeah that's funny, I can imagine that if you only read "inline" that it was
extremely vague :) Having just read the rest of what you posted, I must say there was nothing vague about it at all. Thank you again for your help! And I promise to never fail to read an entire post!
Fair enough.
Greetings Christopher Weaver
"Bart Mermuys" <bm*************@hotmail.com> wrote in message news:Of**************@TK2MSFTNGP14.phx.gbl... Hi,
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:uC**************@TK2MSFTNGP10.phx.gbl... Thanks for writing back, but I must say that I've never read a more terse or vague response.
What's so vague about it, i mean you yourself said you can get the position out of a CurrencyManager, but the position didn't match the DataTable, because a grid is never directly bound to a DataTable or DataSet but to a DataView.
Then i said, you can directly get the current DataRowView from the CurrencyManager like this:
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
Once you have the current DataRowView you can get the value for an individual cell, like:
string richNote = (string)activityDRV["Note"];
I don't know what more i could have told you.
Nevertheless, I scratched my head for a while a concluded that the only possible meaning that I could attribute to your answer in the context of my question was that the grid itself must have the properties I'm looking for.
Really ? All i said was that the CurrencyManager keeps the current row which happens to be a DataRowView.
I looked again at the DataGrid in the help system and realized that I had been looking at the wrong entry. What a difference a few properties can make.
For anyone listening in the working code looks like this:
int ThisRow = dgActivity.CurrentRowIndex; string richNote = dgActivity[ThisRow, 1].ToString();
The way i showed you works, but if you prefer the above, no problem, it's just another way.
Where 1 is the index of the column I'm looking for.
"Bart Mermuys" <bm*************@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, inline
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message news:OA**************@TK2MSFTNGP12.phx.gbl... > 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();
You can get the selected row (DataRowView) directly from the CurrencyManager :
DataRowView activityDRV = (DataRowView)this.BindingContext[dsTaskActivities, "Tasks.TaskActivities"].Current;
string richNote = (string)activityDRV["Note"];
HTH, greeetings
> > 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. >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Rodriguez |
last post by:
Suppose I have a data entry screen with two strongly-typed datasets,
dsCustomers and dsOrders, as the master and child, respectively.
Because the two tables in the relationship are in two...
|
by: Christopher Weaver |
last post by:
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",...
|
by: ruca |
last post by:
Hi,
I have a master and a detail datagrid. I put detail grid showing insise of a
column of master grid. The problem is that it's not what I really want.
What I really want would be that the...
|
by: hlam |
last post by:
Help - Calculating the total of a column in a data grid --
when data grid is part of Master-Detail set-up
I have setup a Master-Detail form using Visual
Studio.Net. A ListBox is the (Master)...
|
by: Krish |
last post by:
Hi,
How to clear detail grid (in master/detail gridview code), without making
any changes to master gridview control. For master/detail iam using gridview
control. I tried setting detail...
|
by: Good |
last post by:
Hi all
I have created a master-detail relationship dataset under VS2005. However,
when I update the tables, it seems the foreign key information couldn't be
passed from the master table,...
|
by: Aspnot |
last post by:
I have a DataSet that contains two tables (Orders and OrderDetails). These
two tables are linked with a relationship that supports cascaded updates and
deletes.
My form is laid out in a...
|
by: Gina_Marano |
last post by:
Hey All,
Working with the .Net data has been the hardest part of my
transition. It just doesn't seem very intuitive.
I want to have a master/detail relationship between 2 grids. When the...
|
by: John |
last post by:
Hi
I am trying to create a master/detail form. I have my master and details
tables dragged onto the dataset. I have also dragged the fields from master
table on the form which has created the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |