Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Clicking Gridview cell

Reply
Thread Tools

Clicking Gridview cell

 
 
Durango2008
Guest
Posts: n/a
 
      05-13-2008
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.


 
Reply With Quote
 
 
 
 
Stan
Guest
Posts: n/a
 
      05-13-2008
On 13 May, 18:33, "Durango2008" <(E-Mail Removed)0m> wrote:
> 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
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      05-13-2008
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" <(E-Mail Removed)0m> wrote in message
news:1ikWj.478$(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Durango2008
Guest
Posts: n/a
 
      05-14-2008

"Stan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)..


Thank you for this suggestion I will look into it


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.Net 2.0 Menu + clicking on cell instead of text only c.nateghi@gmail.com ASP .Net 1 03-02-2007 07:05 PM
datagrid - get the row's column value when clicking on a hyperlink cell vndaxanh@yahoo.com ASP .Net 2 01-23-2006 06:19 PM
Making a cell editable on clicking the cell Prasad Peesapati ASP .Net Web Controls 0 02-03-2005 02:43 PM
Fire event when clicking on the specific cell =?Utf-8?B?dGVuemVlbC4=?= ASP .Net 2 07-28-2004 11:00 AM
I want to be able to access the internet by opening my browser and not right clicking and then clicking connect. James Johnson Computer Support 1 05-15-2004 03:40 AM



Advertisments