Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

GridView button field handler

Posted on 2009-07-08
1
Medium Priority
?
458 Views
Last Modified: 2013-11-07
Hi, Im new to ASP.NET. Im bounding a DataTable to a GridView, but I also added an unbound button field.
 But I dont know where can I catch the event of the button and get the selected row data ?


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ticket.aspx.cs" Inherits="Ticket" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblMessage" runat="server" Width="786px"></asp:Label><br />
        <br />
        <asp:Label ID="Label1" runat="server" Text="Concepto:"></asp:Label>
        <asp:DropDownList ID="cboConcepto" runat="server" Width="173px">
        </asp:DropDownList><br />
        <asp:Label ID="Label2" runat="server" Text="Computadora:"></asp:Label>
        <asp:Label ID="lblComputadora" runat="server" Text="Label" Width="212px"></asp:Label><asp:Label
            ID="Label4" runat="server" Text="Usuario:"></asp:Label><asp:Label ID="lblUsuario" runat="server"
                Text="Label" Width="212px"></asp:Label><asp:Label ID="Label5" runat="server" Text="ip:"></asp:Label><asp:Label
                    ID="lblIP" runat="server" Text="Label" Width="212px"></asp:Label><br />
        <asp:Label ID="Label3" runat="server" Text="Localidad:"></asp:Label>
        <asp:DropDownList ID="cboLocalidad" runat="server" Width="172px">
        </asp:DropDownList>
        <asp:Label ID="Label9" runat="server" Text="Departamento"></asp:Label><asp:DropDownList ID="cboDepartamento" runat="server" Width="172px">
        </asp:DropDownList><br />
        <asp:Label ID="Label6" runat="server" Text="Nombre:"></asp:Label>
        <asp:TextBox ID="txtNombre_Solicitante" runat="server" Width="502px"></asp:TextBox>
        <br />
        <asp:Label ID="Label7" runat="server" Text="Telefono:"></asp:Label>
        <asp:TextBox ID="txtTelefono" runat="server" Width="174px"></asp:TextBox><br />
        <asp:Label ID="Label8" runat="server" Text="Prioridad"></asp:Label><asp:DropDownList ID="cboPrioridad" runat="server" Width="90px">
            <asp:ListItem>Normal</asp:ListItem>
            <asp:ListItem>Urgente</asp:ListItem>
        </asp:DropDownList><br />
        <asp:Label ID="Label10" runat="server" Text="Solicitud:"></asp:Label><asp:TextBox
            ID="txtDescrip_Solicitud" runat="server" Height="125px" Width="578px"></asp:TextBox><br />
        <asp:Button ID="btnAgregar" runat="server" OnClick="btnAgregar_Click" Text="Agregar" />
    </div>
    </form>
</body>
</html>

Open in new window

0
Comment
Question by:_the_reverend
1 Comment
 
LVL 41

Accepted Solution

by:
guru_sami earned 2000 total points
ID: 24809621
where is your gridview in the code?
You can set the CommandName property of the button...then use RowCommand event to do appropriate work.
Or just use Click event of the button ...
0

Featured Post

Independent Software Vendors: 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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

772 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