gridview

Joined
Sep 30, 2011
Messages
1
Reaction score
0
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:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CI_Paciente" 
    DataSourceID="SqlDataSource1">
        <Columns>
            <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="">
                <ItemTemplate>
                     <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/images/comunes/edit.gif" CommandArgument='<%# Eval("CI_Paciente")  %>' OnClick='??' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

Thanks in advance
Carlos
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top