Jump to content

asp.net

- - - - -

  • Please log in to reply
No replies to this topic

#1
cacososa

cacososa

    Newbie

  • Members
  • Pip
  • 1 posts
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


<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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users