我有和我在其中设置templatefield的网格视图。 另外我在后面的代码中动态地设置数据源。 现在templatefield显示为第一列,我想将它移动到第5列,并禁用另一列。 我该怎么做?在gridview中更改templatefield列位置
<asp:GridView ID="gv_DisAlarms" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" PageSize="15"
AllowSorting="True" OnSorting="dataGrid_Sorting"
EnableModelValidation="True" AutoGenerateColumns="true">
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<Columns>
<asp:TemplateField HeaderText="Username" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:HyperLink ID="hl_mailto" runat="server" Text='<%# Bind("Username") %>' NavigateUrl='<%# "mailto:" + Eval("Username") + "?subject=Disabled Alarms&body=Dear " + Eval("Username") + ".%0AIn " + Eval("LastEditDate") + " you put alarm " + Eval("PointID") + " in disable.%0APlease clarify the reason and when it will be enabled.%0AThanks." %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
</asp:GridView>
的解释有没有告诉怎么动模板列列是数据库字段之间,只有之前或之后。 – Aviadjo 2012-03-20 07:49:57