473,831 Members | 2,288 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Data Keys(e.item.ite mindex)


Cheers, Lerp :)
Nov 18 '05 #1
3 2529
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,DataTab le or DataView, type of the e.Item.DataItem is
System.Data.Dat aRowView (DataView's item type), with DataReader it is
System.Data.Com mon.DBDataRecor d 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***@officien ce.ca> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.Data Keys(e.item.ite mindex)


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****@aspalli ance.com> wrote in message
news:#m******** ******@TK2MSFTN GP11.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,DataTab le or DataView, type of the e.Item.DataItem is
System.Data.Dat aRowView (DataView's item type), with DataReader it is
System.Data.Com mon.DBDataRecor d 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***@officien ce.ca> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.Data Keys(e.item.ite mindex)


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***@officien ce.ca> wrote in message
news:#p******** ******@TK2MSFTN GP10.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.Data Keys(e.item.ite mindex)


Cheers, Lerp :)

Nov 18 '05 #4

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

Similar topics

7
4678
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 quite ugly. The black area is larger then it is once an item is added. How can I solve this problem either by: A) Having only the header black and the rest of the empty block white or gray (preffered solution) B) Having the color gray or white...
4
1406
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" cellspacing="0" OnItemDataBound="Details_Item_Bound"> </asp:datagrid> It is bound during runtime to a DataTable that is bound to a SqlDataAdapter. The Details_Item_Bound function changes
8
3053
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 client-side coding needed for the user to click a "select" button (HTMLButton) in column 0 of the datagrid and have the table objects auto-fill with corresponding values from the dataset row in the datagrid without making a roundtrip to the server. ...
1
4350
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 (watch the layout, some have child controls):
0
1337
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 able to do it in two dataGrid. ( one datagrid containing a datagrid in each row ) But I was not able to do it in three dataGrid.
2
3189
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 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp, Selecting Rows by Clicking Anywhere). Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
4
3501
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 snippet from my .css file: *************************** body { margin:0; padding:0;
6
4481
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 rows. So, sting1 should become the first database row, string2 the 2nd, etc, etc So, I tried this:
25
4399
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 opened it in Visual Studio 2005. I've cleared up most errors, but have one that beats the heck out of me. I have a page: sales/Item.aspx that has several datagrids in it.
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10534
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10207
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5619
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.