Hello:
I have a datagrid that has a dataset bound to it. When the customer
selects a certain row in the grid, I would like to be able to grab the
PK for that row, so I can call the customer edit form and load the
textboxes with a SELECT based upon that PK. How do I do this? In
Foxpro, since cursors have global scope, I would just call the edit
form and load the textboxes from the current (selected) record.
Thanks!
Steven 5 1294
The datagrid has a CurrentCell property. CurrentCell is compose of a row
and an index value. YOu can use those (assuming the sort order is the same)
which will correspond the the row and column index of the table its bound
to.
So, if the PK Value was "Bill" and the PK was the first column in your
datatable.
You could the reference dataTable.Rows[DataGrid.CurrentRowIndex][PKName]
<Steven C> wrote in message
news:5u********************************@4ax.com... Hello:
I have a datagrid that has a dataset bound to it. When the customer selects a certain row in the grid, I would like to be able to grab the PK for that row, so I can call the customer edit form and load the textboxes with a SELECT based upon that PK. How do I do this? In Foxpro, since cursors have global scope, I would just call the edit form and load the textboxes from the current (selected) record.
Thanks!
Steven
Thanks, Bill
This seems to return an object, while I need to return the actual PK
value. For Instance, I have:
int PK =
CustomersTable.Rows[grdCustomers.CurrentRowIndex]["customerno"];
But this throws an exception because it's trying to return an object,
not the integer value for the PK.
Steven On Wed, 5 May 2004 16:44:24 -0400, "William Ryan eMVP" <do********@comcast.nospam.net> wrote:
The datagrid has a CurrentCell property. CurrentCell is compose of a row and an index value. YOu can use those (assuming the sort order is the same) which will correspond the the row and column index of the table its bound to.
So, if the PK Value was "Bill" and the PK was the first column in your datatable.
You could the reference dataTable.Rows[DataGrid.CurrentRowIndex][PKName] <Steven C> wrote in message news:5u********************************@4ax.com.. . Hello:
I have a datagrid that has a dataset bound to it. When the customer selects a certain row in the grid, I would like to be able to grab the PK for that row, so I can call the customer edit form and load the textboxes with a SELECT based upon that PK. How do I do this? In Foxpro, since cursors have global scope, I would just call the edit form and load the textboxes from the current (selected) record.
Thanks!
Steven
Just cast it to whatever type the value of the PK is.
<Steven C> wrote in message
news:af********************************@4ax.com... Thanks, Bill
This seems to return an object, while I need to return the actual PK value. For Instance, I have:
int PK = CustomersTable.Rows[grdCustomers.CurrentRowIndex]["customerno"];
But this throws an exception because it's trying to return an object, not the integer value for the PK.
Steven
On Wed, 5 May 2004 16:44:24 -0400, "William Ryan eMVP"
<do********@comcast.nospam.net> wrote:The datagrid has a CurrentCell property. CurrentCell is compose of a row and an index value. YOu can use those (assuming the sort order is the
same)which will correspond the the row and column index of the table its bound to.
So, if the PK Value was "Bill" and the PK was the first column in your datatable.
You could the reference dataTable.Rows[DataGrid.CurrentRowIndex][PKName] <Steven C> wrote in message news:5u********************************@4ax.com.. . Hello:
I have a datagrid that has a dataset bound to it. When the customer selects a certain row in the grid, I would like to be able to grab the PK for that row, so I can call the customer edit form and load the textboxes with a SELECT based upon that PK. How do I do this? In Foxpro, since cursors have global scope, I would just call the edit form and load the textboxes from the current (selected) record.
Thanks!
Steven
Coolness!
Thanks for all your help. :)
Steven On Wed, 5 May 2004 18:42:46 -0400, "William Ryan eMVP" <do********@comcast.nospam.net> wrote:
Just cast it to whatever type the value of the PK is. <Steven C> wrote in message news:af********************************@4ax.com.. . Thanks, Bill
This seems to return an object, while I need to return the actual PK value. For Instance, I have:
int PK = CustomersTable.Rows[grdCustomers.CurrentRowIndex]["customerno"];
But this throws an exception because it's trying to return an object, not the integer value for the PK.
Steven
>On Wed, 5 May 2004 16:44:24 -0400, "William Ryan eMVP"<do********@comcast.nospam.net> wrote: >The datagrid has a CurrentCell property. CurrentCell is compose of a row >and an index value. YOu can use those (assuming the sort order is the
same) >which will correspond the the row and column index of the table its bound >to. > >So, if the PK Value was "Bill" and the PK was the first column in your >datatable. > >You could the reference dataTable.Rows[DataGrid.CurrentRowIndex][PKName] ><Steven C> wrote in message >news:5u********************************@4ax.com.. . >> Hello: >> >> I have a datagrid that has a dataset bound to it. When the customer >> selects a certain row in the grid, I would like to be able to grab the >> PK for that row, so I can call the customer edit form and load the >> textboxes with a SELECT based upon that PK. How do I do this? In >> Foxpro, since cursors have global scope, I would just call the edit >> form and load the textboxes from the current (selected) record. >> >> Thanks! >> >> Steven >> >> >
glad it worked!
<Steven C> wrote in message
news:j6********************************@4ax.com... Coolness!
Thanks for all your help. :)
Steven
On Wed, 5 May 2004 18:42:46 -0400, "William Ryan eMVP"
<do********@comcast.nospam.net> wrote:Just cast it to whatever type the value of the PK is. <Steven C> wrote in message news:af********************************@4ax.com.. . Thanks, Bill
This seems to return an object, while I need to return the actual PK value. For Instance, I have:
int PK = CustomersTable.Rows[grdCustomers.CurrentRowIndex]["customerno"];
But this throws an exception because it's trying to return an object, not the integer value for the PK.
Steven
>On Wed, 5 May 2004 16:44:24 -0400, "William Ryan eMVP" <do********@comcast.nospam.net> wrote: >The datagrid has a CurrentCell property. CurrentCell is compose of a
row >and an index value. YOu can use those (assuming the sort order is the
same) >which will correspond the the row and column index of the table its
bound >to. > >So, if the PK Value was "Bill" and the PK was the first column in your >datatable. > >You could the reference
dataTable.Rows[DataGrid.CurrentRowIndex][PKName] ><Steven C> wrote in message >news:5u********************************@4ax.com.. . >> Hello: >> >> I have a datagrid that has a dataset bound to it. When the customer >> selects a certain row in the grid, I would like to be able to grab
the >> PK for that row, so I can call the customer edit form and load the >> textboxes with a SELECT based upon that PK. How do I do this? In >> Foxpro, since cursors have global scope, I would just call the edit >> form and load the textboxes from the current (selected) record. >> >> Thanks! >> >> Steven >> >> > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steve |
last post by:
Visual Studio 2003 .Net / C#
I have a datagrid, which is bound to a dataset at runtime when my page
loads. When the user double clicks a row, I need to find out which row they
have selected so...
|
by: amber |
last post by:
I have a datagrid, based on a dataview (filled with dataset data from SQL
server).
The dataview contains an ID field, but this field isn't in the datagrid.
How can I get the ID associated with...
|
by: aaa |
last post by:
Hi
I am trying to create a read-only DataGrid that would always have
current row selected. Currently, I am using method:
public void SelectDataGridRow(DataGrid dg)
{
if (dg.CurrentRowIndex >...
|
by: Mike L |
last post by:
This is in a WinForm.
How do I grab all the data in all the cells of the row the user selected OR
all the data in all the cells if the user selects one of the cells in the
row? What event should...
|
by: Carolyn Vo |
last post by:
I have a datagrid in my web control class that I am trying to get the current
rows displayed for. I have enabled paging on the datagrid so if the user is
currently on page 3 of 8, and if I have...
|
by: Cato Lommerud |
last post by:
I have a datagrid control that shows the result from an Acces View and I
want to change the current record for other bound controls when the user
clicks in the different rows in the datagrid. Since...
|
by: JohnR |
last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a
datagridtablestyle defined. I use the datagridtablestyle to change the
order of the columns (so they can be different than...
|
by: Ben |
last post by:
module main
...
application.run(new splashform)
..
end module
after a few screen, I try to load a new codes I got from MSDN on datagrid
that works on its own. I took out submain and ran...
|
by: Holmsey |
last post by:
Hello,
I have a VB.net webform which shows a DataGrid that is actually a query
of 3 tables with the results shown together. I need to be able to take
2 values out of a row when a user clicks the...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
| |