473,396 Members | 2,070 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,396 software developers and data experts.

Clicking Gridview cell

Hi, I have a Gridview which contains data derived from DB table within each
cell.
The cells are created using ItemTemplate containing Labels used for
displaying the data. What I would like to know is if there is a way to be
able to click on the cell to have the data display in another location on
the page?
I could not figure out how to do this so I instead made the labels into
buttons and used the onClick event, which worked fine.
The problem with buttons is, it does not look good within the Gridview
cells, I would rather somehow use Labels to achieve this.
If anyone can help me out I would appreciate it :)
Thank you very much.
Jun 27 '08 #1
3 2018
On 13 May, 18:33, "Durango2008" <el_dura...@yah00.c0mwrote:
Hi, I have a Gridview which contains data derived from DB table within each
cell.
The cells are created using ItemTemplate containing Labels used for
displaying the data. *What I would like to know is if there is a way to be
able to click on the cell to have the data display in another location on
the page?
I could not figure out how to do this so I instead made the labels into
buttons and used the onClick event, which worked fine.
The problem with buttons is, it does not look good within the Gridview
cells, I would rather somehow use Labels to achieve this.
If anyone can help me out I would appreciate it :)
Thank you very much.
Hi

If you use link buttons you can format them so they look like ordinary
text - just set the font-underline property to false and whatever
color etc you like. In a way you can think of link buttons as labels
that do postbacks.

HTH
Jun 27 '08 #2
Hi,

you can add javascript to labels by having code like:

Label1.Attributes.Add("onclick","alert('Label was clicked')")

e.g you could wire client-side script to do the stuff, in case that works
well enough. For server-side clicks to be raised you indeed need a Button or
a custom control (can implement IButtonControl interface or do it just by
causing postback from the click)

Developing a row-clickable GridView gives starters (it' s easy to adapt to
getting clicks from cells) if you'd want to do it that way
http://aspadvice.com/blogs/joteke/ar.../07/14576.aspx

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Durango2008" <el********@yah00.c0mwrote in message
news:1i***************@nlpi061.nbdc.sbc.com...
Hi, I have a Gridview which contains data derived from DB table within
each cell.
The cells are created using ItemTemplate containing Labels used for
displaying the data. What I would like to know is if there is a way to be
able to click on the cell to have the data display in another location on
the page?
I could not figure out how to do this so I instead made the labels into
buttons and used the onClick event, which worked fine.
The problem with buttons is, it does not look good within the Gridview
cells, I would rather somehow use Labels to achieve this.
If anyone can help me out I would appreciate it :)
Thank you very much.

Jun 27 '08 #3

"Stan" <go********@philhall.netwrote in message
news:63**********************************@t54g2000 hsg.googlegroups.com..
Thank you for this suggestion I will look into it ;)
Jun 27 '08 #4

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

Similar topics

1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
10
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
7
by: aljamala | last post by:
Hi, I was wondering if there is a way to make a single cell readonly within a GridView? I know you can do it for a column but what about a cell within that column? Thanks!
1
by: K B | last post by:
I would like to create a gridview as below: Project Name 1-1 1-2 1-3 1-4 1-5 1-6 Project 1 BLUE BLUE BLUE BLUE GREEN GREEN more projects I would like to fill the...
4
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a gridview. I am using template columns inside the gridview. When I display the gridview on the web page and if there is no value in a particular cell, gridline disappaers...
3
by: Bill Gower | last post by:
I have an cell which contains a field member which is filled with String.Empty. When I retrieve the value in the cell with Cells.Text.ToString() and try to compare it to String.Empty, I can't...
0
by: mattd1 | last post by:
I'm using VS2008, and I need to put a gridview into a table cell (an asp table). I made the gridview and set it all up outside the table, then I edit the HTML and move the gridview into the table...
1
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this...
4
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...

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.