问个gridview数据查询的问题 每当查询无数据的时候,下面光秃秃的,很难看。我想让他在无数据的时候也显示标题行,该怎么设置? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 设置AutoGenerateColumns="false"然后手动设置需要的列,并且设置EmptyTemplate中的显示提示即可。http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx 方法一:后台可以 this.GridView1.EmptyDataText = "没有任何数据";方法二:前台可以加个空模板<EmptyDataTemplate> 没有任何数据</EmptyDataTemplate> select * from table where 1 = 2 完全可以显示标题啊,需要显示什么标题自己加<EmptyDataTemplate> <asp:Table ID="Table2" runat="server" Width="560px" BorderWidth="1px" BorderStyle="Solid" CaptionAlign="Top"> <asp:TableRow runat="server" BorderStyle="Solid" BorderWidth="1px" Height="20px" VerticalAlign="Top"> <asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Picture</asp:TableCell> <asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Introduction</asp:TableCell> <asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Room</asp:TableCell> <asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Price</asp:TableCell> </asp:TableRow> <asp:TableRow runat="server" Height="20px" HorizontalAlign="Center"> <asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px" ColumnSpan="4" ForeColor="Red">No data is found! Please change search options and try again.</asp:TableCell> </asp:TableRow> <asp:TableRow runat="server" Height="444px"> </asp:TableRow> </asp:Table></EmptyDataTemplate> C# VS picturebox缩放图片的问题 dev的xtrareport 自定义纸张打印问题? 关于角色权限管理的讨论 如何记住Treeview哪个节点曾经展开过? 菜鸟做《C# 有记忆功能的地址栏控件》这个实例遇到的问题 电梯问题。 反射出TargetException 错误,请问何解?急,在线等,谢谢!! 在.net的XML中dataset和XmlDocument好像不能很好的兼容 苦闷,工作不爽,!!! 散分! c#里如何产生0到1之间的随机浮点数 谁能给我推荐一个c# winfrom控件的书? 字符串的截取问题
然后手动设置需要的列,并且设置EmptyTemplate中的显示提示即可。http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx
<EmptyDataTemplate>
没有任何数据
</EmptyDataTemplate>
<EmptyDataTemplate>
<asp:Table ID="Table2" runat="server" Width="560px" BorderWidth="1px"
BorderStyle="Solid" CaptionAlign="Top">
<asp:TableRow runat="server" BorderStyle="Solid" BorderWidth="1px"
Height="20px" VerticalAlign="Top">
<asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Picture</asp:TableCell>
<asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Introduction</asp:TableCell>
<asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Room</asp:TableCell>
<asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px">Price</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server" Height="20px" HorizontalAlign="Center">
<asp:TableCell runat="server" BorderStyle="Solid" BorderWidth="1px"
ColumnSpan="4" ForeColor="Red">No data is found! Please change search
options and try again.</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server" Height="444px">
</asp:TableRow>
</asp:Table>
</EmptyDataTemplate>