Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2007, 03:34 PM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default which row is clicked in gridwiew

Hi!

I have GridView with TemplateField. In this field is Button. I want to know in which row button are placed when I click on it.

Help!

 
Old March 13th, 2007, 07:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

you have to try this in the rowcreated of your grid:
Code:
        Dim Boton As ImageButton = Nothing
        If e.Row.RowType = DataControlRowType.DataRow Then
            Try
                Boton = e.Row.FindControl("ImageButton1") 'the name of your button
                Boton.CommandArgument = e.Row.RowIndex.ToString()
            Catch ex As Exception

            End Try
        end if
and after that in the rowcommand you will have the the rownumber in e.CommandArgument

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to replace a picture with another when clicked BLaZuRE Beginning VB 6 2 March 11th, 2006 04:08 PM
How to know whick button was clicked. KingArthur Struts 1 February 22nd, 2006 07:12 AM
close the frame this is in when clicked crmpicco HTML Code Clinic 2 August 31st, 2005 08:23 AM
Determining Which Button Was Clicked BrianWren ASP.NET 1.0 and 1.1 Basics 3 May 5th, 2005 03:24 PM
How to tell which button clicked emily PHP How-To 2 November 30th, 2004 01:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.