gridview

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

  1. cacososa

    cacososa

    Joined:
    Sep 30, 2011
    Messages:
    1
    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
    cacososa, Sep 30, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nalaka

    GridView in a GridView

    Nalaka, Nov 11, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    6,606
    Nalaka
    Dec 5, 2005
  2. wallermj@hotmail.com
    Replies:
    3
    Views:
    5,113
    wallermj@hotmail.com
    Nov 21, 2005
  3. Carlos Albert

    GridView in a GridView

    Carlos Albert, Dec 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    499
    Carlos Albert
    Dec 6, 2005
  4. Carlos Albert

    Gridview inside Gridview little problems...

    Carlos Albert, Dec 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,658
    Carlos Albert
    Dec 6, 2005
  5. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,965
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
Loading...

Share This Page