Discussion in '.NET' started by cacososa, Sep 30, 2011.

  1. cacososa


    Sep 30, 2011
    Likes Received:
    Hi I have a gridview and here is what I'm trying to do.

    For each row in the gridview I want to add a column with a link or image button. When the user clicks on the link I would like to fill some form fields with the data from the row that the user clicked on.

    I added a templatefield to my gridview and now I have the link that I wanted. What I can't figure out is how to get the data from the row and fill the form fields with that data.

    Can anyone help me out..

    here is my code for the gridview

    Code (Text):

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CI_Paciente"
                <asp:BoundField DataField="Nombre" HeaderText="Nombre"
                    SortExpression="Nombre" />
                <asp:BoundField DataField="CI_Paciente" HeaderText="CI_Paciente"
                    ReadOnly="True" SortExpression="CI_Paciente" />
                <asp:BoundField DataField="Apellido" HeaderText="Apellido"
                    SortExpression="Apellido" />
                <asp:BoundField DataField="Historia" HeaderText="Historia"
                    SortExpression="Historia" />
                <asp:BoundField DataField="Primera_Visita" HeaderText="Primera_Visita"
                    SortExpression="Primera_Visita" />
                <asp:TemplateField HeaderText="">
                         <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/images/comunes/edit.gif" CommandArgument='<%# Eval("CI_Paciente")  %>' OnClick='??' />
    Thanks in advance
    cacososa, Sep 30, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.