在网格视图中添加控件

问题描述:

如何在网格视图中添加标签控件.

How can i add lable control in a grid view.

您好,您想在运行时添加标签控件.

检查下面的链接.

http://support.microsoft.com/kb/317794

祝一切顺利


试试这个代码

Hi you want add label control in runtime right.

check below link for it.

http://support.microsoft.com/kb/317794

All the best


Try this code for it

<asp:DataList ID="DataList1" runat="server">
  <HeaderTemplate >
    <table width="100%" align="center">
      <tr>
        <td>Answers</td>
        <td>Views</td>
        <td>Question</td>
      </tr>
  </HeaderTemplate>
  <itemtemplate>

      <tr>
        <td>
            <asp:Label ID="Label2" runat="server" Text='<%#Eval("ans") %>'></td>
        <td>
            <asp:Label ID="Label3" runat="server" Text='<%#Eval("views") %>'></td>
        <td><%#Eval("qname") %></td>
      </tr>

  </itemtemplate>
  <footertemplate>
      </footertemplate></table>