Kgabo
Kgabo

Reputation: 13

GridView Control (Visual Studio ASP.Net 2008 C#)

I'm having a GridView of about 7000 rows and i want to add an update button on each row. When the user click that button,i want to display all the information in that particular row into the textboxes and let the user update and save.

The names of my textboxes are:

txtEmployeeNumber, txtSurname, txtFirstName, txtPosition

My GridView name is: gvMain My server name is: bisweb\bisweb My database name is: x_kgabo Can anyone help!

Upvotes: 0

Views: 935

Answers (2)

x2.
x2.

Reputation: 9668

<asp:TemplateColumn>
    <ItemTemplate>
        <asp:Button Runat="server" ID="makeSomehtingButton"
CommandName="makeSomething" 
CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ID") %>'>
</asp:Button>
    </ItemTemplate>
</asp:TemplateColumn>

Upvotes: 1

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Simply add template field in your gridview

<asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="ibtnRateIt" CommandArgument='<%# Eval("id") %>' CommandName="RateIt"
                        runat="server" ImageUrl="~/Images/RateIt.gif" />

                </ItemTemplate>
            </asp:TemplateField>

Upvotes: 1

Related Questions