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 2028
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: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |