Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to determine which cell was clicked in as ASP.NET DataGrid

Posted on 2006-05-30
6
Medium Priority
?
248 Views
Last Modified: 2012-06-27
Hi experts,

i have a datagrid. In each cell of my datagrid, i have one label control and a button control.
My question is, when user clicks on the button how can i determine which column is clicked?

Regards
0
Comment
Question by:Raju Srivatsavaye
  • 4
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16792556
What type of column is the button column defined as?  ButtonColumn or TemplateColumn?

Bob
0
 
LVL 9

Author Comment

by:Raju Srivatsavaye
ID: 16792566
TemplateColumn
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16792575
What do you want to do when the button is clicked?

Bob
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 96

Expert Comment

by:Bob Learned
ID: 16792580
.Net version?

Bob
0
 
LVL 9

Author Comment

by:Raju Srivatsavaye
ID: 16792623
when the button is clicked, i want to get the text in the first column of that row and the column number and pass those two values to my next page.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 16792627
For 1.1, you can handle the ItemCommand like this example:

Sub ItemsGrid_Command(sender As Object, e As DataGridCommandEventArgs) Handles ItemsGrid.ItemCommand

         Select (CType(e.CommandSource, LinkButton)).CommandName

            Case "Delete"
               DeleteItem(e)

            ' Add other cases here, if there are multiple ButtonColumns in
            ' the DataGrid control.

            Case Else
               ' Do nothing.

         End Select

      End Sub

Bob
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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…
Integration Management Part 2
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

564 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