you have to do it in ItemDataBound event handler, but here is a simpler solution:<asp:TemplateColumn>
<ItemTemplate> <asp:TextBox id="txt_cj" Runat="server" text='' Visible='<%# SomeCondition%>'></asp:TextBox>
<asp:DropDownList id="ddl" Runat="server" Visible='<%# !SomeCondition %>'></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>replace "SomeCondition" with some expression which might be of the format of
(bool)DataBinder.Eval(Container.DataItem,"SomeColumn")
<ItemTemplate> <asp:TextBox id="txt_cj" Runat="server" text='' Visible='<%# SomeCondition%>'></asp:TextBox>
<asp:DropDownList id="ddl" Runat="server" Visible='<%# !SomeCondition %>'></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>replace "SomeCondition" with some expression which might be of the format of
(bool)DataBinder.Eval(Container.DataItem,"SomeColumn")
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货