简体   繁体   中英

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM