473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HELP: Getting row column values in ASP.NET datagrid?

I have a datagrid bound to a dataset table.

Unfortunately, the table's primary key consists of not 1, but 3
columns, so I cannot correctly set the DataKeyField property of the
grid (it only allows for 1 column), and, therefore, cannot use syntax
like below in the event handlers in order to retrieve the primary key
of the row:

this.gridList.DataKeys[e.Item.ItemIndex]

I still need to be able to get the values of all 3 key columns, yet I
am not sure how. Any ideas?

TIA!
Nov 19 '05 #1
2 1534
Place the primary keys on the grid using <asp:BoundColumn Visible=False
DataField ="PrimaryKey1" ReadOnly =True ></asp:BoundColumn> In this way you
can retrieve them and locate your records but the user would not see them. I
have an example on this link http://societopia.net/samples/datagrid_4c.aspx
that works based on multiple primary keys to display a child datagrid and to
update the values in the parent grid.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Usenet User" wrote:
I have a datagrid bound to a dataset table.

Unfortunately, the table's primary key consists of not 1, but 3
columns, so I cannot correctly set the DataKeyField property of the
grid (it only allows for 1 column), and, therefore, cannot use syntax
like below in the event handlers in order to retrieve the primary key
of the row:

this.gridList.DataKeys[e.Item.ItemIndex]

I still need to be able to get the values of all 3 key columns, yet I
am not sure how. Any ideas?

TIA!

Nov 19 '05 #2
Thank you!

On Fri, 9 Sep 2005 19:40:04 -0700, "Phillip Williams"
<Ph**************@webswapp.com> wrote:
Place the primary keys on the grid using <asp:BoundColumn Visible=False
DataField ="PrimaryKey1" ReadOnly =True ></asp:BoundColumn> In this way you
can retrieve them and locate your records but the user would not see them. I
have an example on this link http://societopia.net/samples/datagrid_4c.aspx
that works based on multiple primary keys to display a child datagrid and to
update the values in the parent grid.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element?...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
4
by: momo | last post by:
Hello all, I need help with this. I have a datagrid (dg1) with checkboxes and I want when some rows are selected to populate another datagrid (dg2) with the selected rows from (dg1). Thanks ...
2
by: Colin McGuigan | last post by:
This is a translation of an ASP page to ASP.Net. First, the background: The goal is to have a grid of different settings for the application -- think something along the lines of the Property...
1
by: Lenin Sakthees via .NET 247 | last post by:
Hi all, I am using a datagrid to show values from a SQL table. My problem is, I want to show the details of the each row when the user clicks the 'View details' buttoncolumn. I am able to fire a...
10
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
4
by: Pacific Design Studios | last post by:
I have a DataGrid on Form1 that displays a small amount of information about employees. On Form2 I want to have all the data displaying in text boxes about the employee selected in the datagrid on...
6
by: Coleen | last post by:
Hi All :-) Thanks for all of your help Cor :-) I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message...
1
by: nate axtell | last post by:
In VB .NET I load the contents of an Excel or comma seperated values file into a dataGrid (via a datatable). One of the columns has a comma in the name of the column. So for the comma separated...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
marktang
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.