473,786 Members | 2,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get cell string value from datagrid

Hi,

I have a datagrid with 2 columns. 1 is a bound column and the other one is a
button column configured as a link button. When I click the link button, the
ItemCommand Event fires as it is supposed to. I am able to get the value
from the first column using

e.item.cells(0) .text

but I need to get the string value from the link button that was clicked, So
obviously I thought I would get that from

e.item.cells(1) .text

But this always returns a empty string....

Am I doing something wrong, or is there another way I can get this value ?
Regards

Niclas
Nov 18 '05 #1
2 3360
Niclas,

In your ItemCommand procedure, do this:

'~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
'Respond to item being clicked
Dim btn As LinkButton = CType(e.Command Source, LinkButton)

Select Case btn.Text
Case "Details"

....etc...

End Select
'~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

Regards,

Alec
"Niclas Lindblom" <no************ ********@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I have a datagrid with 2 columns. 1 is a bound column and the other one is a button column configured as a link button. When I click the link button, the ItemCommand Event fires as it is supposed to. I am able to get the value
from the first column using

e.item.cells(0) .text

but I need to get the string value from the link button that was clicked, So obviously I thought I would get that from

e.item.cells(1) .text

But this always returns a empty string....

Am I doing something wrong, or is there another way I can get this value ?
Regards

Niclas

Nov 18 '05 #2
Cool, Thanks !

"alec maclean" <al**********@c opeohs.com.NO_S PAM> wrote in message
news:ub******** *****@TK2MSFTNG P11.phx.gbl...
Niclas,

In your ItemCommand procedure, do this:

'~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
'Respond to item being clicked
Dim btn As LinkButton = CType(e.Command Source, LinkButton)

Select Case btn.Text
Case "Details"

...etc...

End Select
'~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~

Regards,

Alec
"Niclas Lindblom" <no************ ********@hotmai l.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I have a datagrid with 2 columns. 1 is a bound column and the other one
is

a
button column configured as a link button. When I click the link button,

the
ItemCommand Event fires as it is supposed to. I am able to get the value
from the first column using

e.item.cells(0) .text

but I need to get the string value from the link button that was clicked,

So
obviously I thought I would get that from

e.item.cells(1) .text

But this always returns a empty string....

Am I doing something wrong, or is there another way I can get this value
?
Regards

Niclas


Nov 18 '05 #3

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

Similar topics

2
1852
by: Stephen | last post by:
I'm trying to work with a datagrid column in order to display a tooltip in a datagrid cell. The reason I am doing this is because I have some long strings being returned and I don't want the rows of the datagrid expaning down to much. I basically want to display the first 50 characters in the grid cell and then display the rest as a tooltip in the grid cell. I'm not sure if this is possible but if anyone can help me do this I would be very...
2
3183
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) _
21
2388
by: coleenholley | last post by:
I've been trying since last Friday to get an answer on how to get a SPECIFIC row.cell value from a datagrid. I've had plenty of suggestions, but nothing works to get the value from a SPECIFIC Row and cell. Right now I have this code Sub Item_Bound(ByVal sender As Object, ByVal e As DataGridItemEventArgs lbl_test.Text = lbl_test.Text & " " & e.Item.ItemInde Session("wa_tot_gal") = e.Item.Cells(7).Tex Response.Write(Session("wa_tot_gal")...
4
10704
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to make sure entry is valid? Thanks, Rog
10
4956
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 the column order of the datatable). I also allow the user to click on a column header to sort the datagrid by that column. I need to identify the row and column in the datatable when the user clicks on a cell in the datagrid. Using the...
0
9650
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
9497
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
10363
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
10110
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,...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.