Solved

read gridview cell data

Posted on 2013-05-11
2
731 Views
Last Modified: 2013-05-12
I wonder if it is possible to read the content of a select cell via a click on that cell. Say, row 2 and column 3 displays "abc" string. Now, when user clicks on this cell, I want the following code to be executed in some event:

dim strTemp As String = <cell content "abc">
Response.write(strTemp)

Upon click on this cell, it is expected string "abc" to appear on the web page.

What event(s) in a gridview this code should go? I can use any other control you may suggest capable of this function where the data is displayed in a tabular fashion.

(If I was using MS Access, for example, I could have done this via a listbox control or subform.)

The link below explains the process but I am not quite sure how to apply it yet:

http://www.dreamincode.net/forums/topic/184448-using-gridview-and-rowcommand-events/

Someone explained how I can doe this by saying:

"... you can pull in a couple of arguments from the GridViewCommandEventArgs.  You can get the CommandName and the CommandArgument.  You will see when you add LinkButtons and Buttons that they have CommandNames and CommandArgument properties which can be set.  During the databinding you can dynamically assign values to these properties such as a column index.
Then in the rowcommand event you will have access to them by way of the GridViewCommandEventArgs."

You can see this in the last code block of the above link.

Question: Could you please help me to make this work? You could possibly help me to understand it all by a sample code.

Thank you.
0
Comment
Question by:Mike Eghtebas
2 Comments
 
LVL 8

Accepted Solution

by:
rpkhare earned 500 total points
ID: 39159126
Check the last solution titled "Making each GridView individual cells Clickable and Selectable" in this link:

Making each GridView individual cells Clickable and Selectable:

Also check this link:
Edit Individual GridView Cells in ASP.NET
0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 39159454
Thank you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question