473,394 Members | 1,813 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,394 software developers and data experts.

converting datagrid item into row

Hi all,

What's the syntax for creating a row out of the current item in a datagrid?
Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)
Nov 18 '05 #1
3 2507
This could work only during the same request when DataGird is databound.
Then you could access the data source row via e.Item.DataItem, that is,
DataItem property of the DataGridItem. By the way, when you bind to
DataSet,DataTable or DataView, type of the e.Item.DataItem is
System.Data.DataRowView (DataView's item type), with DataReader it is
System.Data.Common.DBDataRecord and for other types it is the type of the
custom item.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Lerp" <ad***@officience.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi all,

What's the syntax for creating a row out of the current item in a datagrid?

Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)

Nov 18 '05 #2
Ok thank you Teemu ,

What I am really trying to get at is the parentrow for the current DataItem
of the datagrid. You see, I have a dataset comprised of 3 tables
(Employee, Client and Order) with 2 relations as well. In my aspx page I
have a datagrid bound to this dataset, howver, the last two columns of my
row are ID fields...so what I am doing is calling a sub on itemdatabound to
retrieve the parent row for the given datagrid row so I can access and
display Employee and Client names instead of ID values. Can I still do this
with the DataRowView Object?

Cheers, Lerp :)
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:#m**************@TK2MSFTNGP11.phx.gbl...
This could work only during the same request when DataGird is databound.
Then you could access the data source row via e.Item.DataItem, that is,
DataItem property of the DataGridItem. By the way, when you bind to
DataSet,DataTable or DataView, type of the e.Item.DataItem is
System.Data.DataRowView (DataView's item type), with DataReader it is
System.Data.Common.DBDataRecord and for other types it is the type of the
custom item.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Lerp" <ad***@officience.ca> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi all,

What's the syntax for creating a row out of the current item in a

datagrid?


Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)


Nov 18 '05 #3
hi agian,

So, could I use the row property of the datarowview to make a new datarow so
I can get to the parent row?

Cheers, Lerp :)

"Lerp" <ad***@officience.ca> wrote in message
news:#p**************@TK2MSFTNGP10.phx.gbl...
Hi all,

What's the syntax for creating a row out of the current item in a datagrid?

Something like this ?

Dim myRow as DataRow = mydataGrid.DataKeys(e.item.itemindex)


Cheers, Lerp :)

Nov 18 '05 #4

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

Similar topics

7
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is...
4
by: John Doe | last post by:
Hi I want to convert a column to a link. All examples I have seen works with bound columns. I have the following grid: <asp:datagrid runat="server" id="__theDetailsGrid" cellpadding="2"...
8
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
0
by: BK Kim | last post by:
Hello. I am trying to use dataGrid in a dataGrid, meaning first DataGrid displays some information and on each row, it is going to have another datagrid to display detailed information. I was...
2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
6
by: Eric Broers | last post by:
LS, Assume I have a datagrid, which is filled by an SQL statement (Select * from Customer). The Customers table contains 4 columns and 10 rows. Now, I want to fill 10 strings with the datagrid...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...
0
Oralloy
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,...
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...
0
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...
0
tracyyun
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 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.