根据Eval()函数绑定的值,来显示GridView中的控件的

编程学习 2021-07-04 22:40www.dzhlxh.cn编程入门
根据Eval()函数绑定的值,来显示GridView中的控件的方法,需要的朋友可以参考一下

代码如下:

<asp:TemplateField HeaderText="操作" ShowHeader="False">
                                <ItemTemplate>
                                <asp:LinkButton ID="btn_zhiding" runat="server" CommandName="Tranfer" CommandArgument='<%#Eval("ARTICLE_ID")%>' Text='<%#Eval("BeTop") == "置顶" ? "取消置顶":"置顶" %>' OnCommand="RowCommand"></asp:LinkButton>
                               <asp:PlaceHolder ID="PlaceHolder1"  runat="server" Visible='<% #Eval("BeTop") == "置顶"%>'>
                                <asp:ImageButton ID="imgBtn_OrderUp" runat="server" ImageUrl="~/pic/向上.jpg" CommandName="OrderUp"
                                        CommandArgument='<% #Eval("ARTICLE_ID") %>' OnCommand="RowCommand" />
                                    <asp:ImageButton ID="imgBtn_OrderDown" runat="server" ImageUrl="~/pic/向下.jpg" CommandName="OrderDown"
                                        CommandArgument='<% #Eval("ARTICLE_ID") %>' OnCommand="RowCommand" />
                                     </asp:PlaceHolder>
                                </ItemTemplate>

                                <ItemStyle HorizontalAlign="Center"/>
                            </asp:TemplateField>


根据绑定的值,动态显示GridView中每一行中的控件,

用<asp:PlaceHolder runat="server" Visible='<% #Eval("BeTop") == "置顶"%>'>

 

Copyright © 2016-2025 www.dzhlxh.cn 金源码 版权所有 Power by

网站模板下载|网络推广|微博营销|seo优化|视频营销|网络营销|微信营销|网站建设|织梦模板|小程序模板