使用模板字段绑定gridview [英] Binding the gridview using template field

查看:52
本文介绍了使用模板字段绑定gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海,

我正在使用gridview绑定数据.我使用了common字段来进行编辑,更新,并使用bounded字段来进行列标题.我已将值插入到网格视图中.但是我的问题是,我们在网格视图中的哪里使用模板字段.

这是示例代码

Hai,

I am using the gridview to bind the data.I used common field for edit,update and bound field for column headers. I have inserted values into grid view. But my question is where we use the template field in grid view.

Here is a sample code

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            
            onrowcancelingedit="GridView1_RowCancelingEdit" 
            onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" 
            onrowupdating="GridView1_RowUpdating">
            <columns>
              <asp:CommandField HeaderText="Edit-Update" ShowEditButton="True" />
                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" />
                <asp:BoundField DataField="NAME" HeaderText="NAME" />
                <asp:BoundField DataField="AGE" HeaderText="AGE" />
                <asp:BoundField DataField="PLACEOFBIRTH" HeaderText="PLACEOFBIRTH" />
                <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" />


            </columns>

推荐答案

以下是针对相同内容的快速教程:

http://msdn.microsoft.com/en-us/library/bb288032.aspx [ ^ ]
Well below is quick tutorial for the same:

http://msdn.microsoft.com/en-us/library/bb288032.aspx[^]


这篇关于使用模板字段绑定gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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