可编辑网格视图如何 [英] editable grid view how to

查看:91
本文介绍了可编辑网格视图如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我有gridview,每个有5-10条记录。每个记录在db ..中有大约30个列字段,但为了简单起见,我只在数据网格中显示5个。



这些记录中的每一个都应该是可编辑的。当我点击其中一个编辑时...我希望所有30个文本框都加载这些记录。





如何在.net 4.0中实现这个目标



谢谢

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

推荐答案

对每列使用TemplateFields,如果列需要在正常和编辑模式下显示,请将它包含在 EditItemTemplate ItemTemplate 。如果控件需要仅在编辑中显示,则仅包含 EditItemTemplate ,如下所示

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: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>


这篇关于可编辑网格视图如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆