Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   HTML, Javascript y otros (https://www.clubdelphi.com/foros/forumdisplay.php?f=38)
-   -   Ayuda con GridView (https://www.clubdelphi.com/foros/showthread.php?t=86102)

socra 17-06-2014 20:23:08

Ayuda con GridView
 
Hola buenas tardes, de su ayuda con el siguiente problema, tengo un Gridview que se llena con una BD, la cual tiene 3 columnas, id_user, user_name, mail, al Grid se le agrego un botón "send" el cual toma debe tomar el valor de la celda "mail" en la fila del botón, es aquí donde presento problemas y solicito de su ayuda, ya que no logro obtener el valor de esta celda al dar clic en el botón "send" que tiene otra ubicación.

esta es el código del Grid

Código:


<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
            AllowSorting="True" AutoGenerateColumns="False" BackColor="White"
            BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4"
            DataKeyNames="id_user" DataSourceID="SqlDataSource1" onrowcommand="GridView1_RowCommand">
            <Columns>
                <asp:TemplateField HeaderText="Edit/Delete/Select">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
                            CommandName="Edit" Text="Edit"></asp:LinkButton>
                          &nbsp;<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False"
                            CommandName="Delete" Text="Delete" OnClientClick="mensajeConfirm(event, '¿Desea eliminar registro?')"></asp:LinkButton>
                          &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
                            CommandName="Select" Text="Select"></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True"
                            CommandName="Update" Text="Update"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="id_user" HeaderText="ID User" ReadOnly="True"
                    SortExpression="id_user" />
                <asp:BoundField DataField="user_name" HeaderText="User name"
                    SortExpression="user_name" />
                <asp:BoundField DataField="mail" HeaderText="Mail" SortExpression="mail" />
                <asp:BoundField DataField="comments" HeaderText="Comments"
                    SortExpression="comments">
                <ControlStyle Height="90px" />
                </asp:BoundField>                             
                <asp:TemplateField HeaderText="Send">
                    <ItemTemplate>
                        <asp:Button ID="Send" runat="server" CausesValidation="false"
                            CommandName="Send" Text="Send" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#330099" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <SortedAscendingCellStyle BackColor="#FEFCEB" />
            <SortedAscendingHeaderStyle BackColor="#AF0101" />
            <SortedDescendingCellStyle BackColor="#F6F0C0" />
            <SortedDescendingHeaderStyle BackColor="#7E0000" />
        </asp:GridView>
        <asp:Label ID="Label2" runat="server" Text=""></asp:Label><br />
            <asp:Label ID="Label3" runat="server" Text=""></asp:Label><br />
            <asp:Label ID="Label7" runat="server" Text=""></asp:Label>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:CustomerInfoConnectionString %>"
            DeleteCommand="DELETE FROM [MasterList] WHERE id_user = @id_user"
            InsertCommand="INSERT INTO [MasterList] (id_user,user_name,mail,comments) VALUES (@id_user,@user_name,@mail,@comments)"
            SelectCommand="SELECT * FROM [MasterList]"
            UpdateCommand="UPDATE [MasterList]
  SET user_name = @user_name
      ,mail = @mail
      ,comments = @comments
      WHERE id_user = @id_user">
            <DeleteParameters>
                <asp:Parameter Name="id_user" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="id_user" />
                <asp:Parameter Name="user_name" />
                <asp:Parameter Name="mail" />
                <asp:Parameter Name="comments" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="id_user" />
                <asp:Parameter Name="user_name" />
                <asp:Parameter Name="mail" />
                <asp:Parameter Name="comments" />
            </UpdateParameters>
        </asp:SqlDataSource>
        <br />


De antemano gracias !!!

Faust 19-06-2014 19:30:11

Da más detalles... :confused: :confused: :confused:


La franja horaria es GMT +2. Ahora son las 04:25:38.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi