Groups | Blog | Home
all groups > asp.net datagrid control > september 2006 >

asp.net datagrid control : Executing a Method when i click the template column


n.nsiva NO[at]SPAM gmail.com
9/13/2006 11:59:15 PM
Hai All

I have an problem and needs a solution, the problem is described
below..

I have place a datagrid with 3 bound columns and 1 template column
where on that template column i pace a link button web server control
on the item template. Now what i need is whenever i click that
particular linkbutton of a column i want to execute a simple method.

Hope all reply to me.
Sivakumar.N
Teemu Keiski
9/16/2006 12:00:00 AM
Hi,

wire a handler method to the LinkButton in the ItemTemplate

<asp:linkButton ID="..." OnClick="LinkButton_Click" />

It would make the event handler method same for all LinkButtons but you can
get the specific one by casting 'sender' argument to LinkButton. Another way
would be just applying CommandName attribute to it and handling ItemCommand
event (RowCommand in GridView)

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

[quoted text, click to view]

AddThis Social Bookmark Button