本文介绍了如何使用后面的VB代码添加GridView的ItemTemplate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
有人可以帮我做我的密码吗?
我想在gridview中创建一个动态列.
我的样本:

Good day to everyone.
can anybody help me with my codes?
I want to create a dynamic column in gridview..

My sample:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"   DataKeyNames="EmployeeID" DataSourceID="ObjectDataSource1">
     <columns>
        <asp:BoundField DataField="LastName" HeaderText="LastName"        SortExpression="LastName" />
        <asp:BoundField DataField="FirstName" HeaderText="FirstName"          SortExpression="FirstName" />
        <asp:BoundField DataField="Title" HeaderText="Title"          SortExpression="Title" />
        <asp:BoundField DataField="HireDate" HeaderText="HireDate"          SortExpression="HireDate" />
    </columns>



我的问题是如何创建动态列.意思是说< column>内部的所有数据都是将在后台代码中动态创建.它可以是BoundField,也可以是ItemTemplate(我更喜欢ItemTemplate),最终代码是



My problem is how to create a dynamic column. Meaning to say all data inside <column> will be created dynamically at code-behind. It can be either BoundField or by ItemTemplate (i prefer ItemTemplate please) the final code would be

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EmployeeID" DataSourceID="ObjectDataSource1">
<column>
...all code here will be created at code behind...
</column>

推荐答案


这篇关于如何使用后面的VB代码添加GridView的ItemTemplate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 00:11