Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I have gridview that has 5-10 records each. Each record has about 30 column fields in the db..but im display only 5 in the datagrid for simplicity purposes.

Each of these records should be editable. When I click edit on one of them ...I want all the 30 textboxes to load with each of these records.


How to achieve this in .net 4.0

Thanks
Posted

1 solution

Use TemplateFields for each column, if the column need to be displayed on normal and edit mode, include the it in both EditItemTemplate and ItemTemplate. if the control need to be show in only editing , include only EditItemTemplate like below
ASP.NET
<asp:templatefield headertext="FirstName" sortexpression="FirstName" xmlns:asp="#unknown">
    <edititemtemplate>
        <asp:textbox id="TextBox1" runat="server" text="<%# Bind("FirstName") %>"></asp:textbox>
    </edititemtemplate>
    <itemtemplate>
    </itemtemplate>
</asp:templatefield>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900