473,516 Members | 3,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Want the data from One row on a datagrid

9 New Member
I'm knew to writing code and this might not make perfect sense but here goes.

I have a datagrid with multiple lines of data. The thing I want to do is have a button on the datagird that when i click it, all the information of that row goes into a session variable.
Separately of course, meaning If the Column is called CustomerName and its the 3rd cell over. what I've tried to do is
Session["CustomerName"] = e.Item.Cells[3].Text;
But it always shows ("").
I tryed using this. When the button is clicked it goes into this but never gives me a value
switch (e.Item.ItemType)
{

case ListItemType.AlternatingItem:
case ListItemType.EditItem:
case ListItemType.Item:
case ListItemType.SelectedItem:
Session["CustomerName"] = e.Item.Cells[3].Text;
break;
// case ListItemType.Footer:


}

I'm writing this in C# in asp.net...hopefully somebody can help me. Thanks
Nov 29 '06 #1
3 917
bplacker
121 New Member
well in vb.net... it would be

grid.selectedrows(0).cells(3).value.toString
Nov 29 '06 #2
cr115
9 New Member
Yeah I tryed converitng it but it didn't like what i put..Thanks though...if any body know the equivallent c# value that would be awsome.
Nov 29 '06 #3
bplacker
121 New Member
Also make sure that you have the selectionMode of the datagridview set to FullRowSelect, when trying to do this.
Nov 29 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4891
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on...
0
4215
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html formating. the datagrid also has paging. I'm doing a ASP.NET guestbook. I know some things could be improved like adding some error handling and caching...
2
2232
by: Andy Sutorius | last post by:
Can someone point me to an article on how to edit a datagrid when the grid is set to autogeneratecolumns? Each article I have come across has instructions when autogenerate is false and you have an item template with data containers. Thanks Andy
7
3354
by: Brian Henry | last post by:
Hi, I have a data grid that has the following properties EnableViewState = false AllowPaging = true AllowSorting = true AllowCustomPaging = false now, when the page switches I want to get the current page number and display it in a label on the form... but it doesnt seem to return anything but zero no mater which page i am on in...
6
3824
by: Hutty | last post by:
I've looked around and have yet to find anything that would answer my question regarding formating a column in a datagrid. My grid looks like this as far as data" AMHQCON|51300.01|-3147 The first two columns are pretty much text column, but subsequent columns 1-12 are numerical. I'm trying to get the thousand separator to work. Any...
5
2758
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the...
1
1795
by: pv_kannan | last post by:
One of our dev team members is having a strange problem with a datagrid... We are not seeing a datagrid's data getting refreshed after a new row is entered in a popup window inspite of resetting the datasource and rebinding it. We have a datagrid (enabled viewstate) that binds to a collection class that inherits the IList interface. The...
7
1418
by: Mike Fellows | last post by:
Below is my code that is carried out on my dataset, datagrid etc... Im trying to get column0 "Date & Time" to show date and time, not just date ive read some stuff posted by Dmitriy Lapshin on this board that goes way over my ability (this is my first vb or vb.net project). from what I can tell i need a GridColumnStyles collection...
4
9117
by: Peter | last post by:
Does anyone know a way to import excel data very fast? I have spreadsheet data that has to be processed, the spreadsheet has 256 columns and 20,000 rows of data. That's 5,120,000 cells. The cells can contain any type of data, but the data has to be coverted to Double arrays. Currently I read the data from the spreadsheed using OleDB and...
1
2284
by: geeteshss | last post by:
Dear all, actually i spent a whole month on the R&D of datagrid edit ,update,cancel events but recently my guide told me to make it user friendly because no user would like to go on searching rows and columns in a datagrid if there are number of rows and columns.so in my web page i have got two labels two textboxes and three buttons namely add...
0
7273
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...
0
7182
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...
0
7405
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. ...
1
7136
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...
0
7547
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...
0
5712
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...
0
3265
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...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.