网格视图标题显示即使gridview数据源为空 [英] grid view header show even the gridview datasource is empty

查看:66
本文介绍了网格视图标题显示即使gridview数据源为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果网格视图数据源为空,如何启用查看网格视图标题。我正在使用dotnet framework3.5。



 <   asp:GridView     ID   =  GridView1    runat   =  server    AutoGenerateColumns   =  False  

< span class =code-attribute> DataSourceID = odsAccountOpening EnableModelValidation = True 高度 = 135px

< span class =code-attribute> 宽度 = 942px >
< > ;
< asp:BoundField DataField = AccountNo HeaderText = 帐号否

< span class =code-attribute> SortExpression = AccountNo / >
< ; asp:BoundField DataField = SycDepositTypeId HeaderText = 存款类型

SortExpression = SycDepositTypeId / >
<% - < asp:TemplateField HeaderText = 存款类型 < span class =code-keyword>>
< ItemTemplate>
< asp:Label ID = lblDepositType1 runat = server Text = ' <%#DataBinder.Eval(Container,DataItem.SycDepositType.DepositTypeName)%>' > < / asp:标签 >
< / ItemTemplate >
< / asp:TemplateField > - %GT;
< asp:BoundField DataField = MamAccountHolderTypeId HeaderText = 帐户类型

SortExpression = MamAccountHolderTypeId / >
< asp:BoundField DataField = InterestRate HeaderText = 利率

< span class =code-attribute>
SortExpression = InterestRate / >
< asp:BoundField DataField = AccountOpenOnBs HeaderText = A / C打开

< span class =code-attribute> SortExpression = AccountOpenOnBs / >
< asp: BoundField DataField = MaturityOn HeaderText = < span class =code-keyword>成熟度

< span class =code-attribute> SortExpression = MaturityOn / >
< span class =code-keyword>< asp:BoundField DataField = MamAccountStatusId HeaderText = 帐户状态

SortExpression = MamAccountStatusId / >
< /列 >
< / asp:GridView > ;
< asp:ObjectDataSource ID = odsAcco untOpening runat = server

< span class =code-attribute>
OldValuesParameterFormatString = original_ {0}

onobjectcreating = odsAccountOpening_ObjectCre ating SelectMethod = GetAll

< span class =code-attribute> < span class =code-attribute> TypeName = MemberAccountManagement.BLL.CMamAccountOpening >
< / asp:ObjectDataSource >

解决方案

Hello用户,



ShowHeaderWhenEmpty 属性设置为true 。



问候,

这里有几个解决方案



GridView - 在空数据源上显示标题 [ ^ ]


ShowHeaderWhenEmpty =True



这是数据源为空时显示标题的解决方案



否则你可以使用Listview。



希望这有助于!!!


How to enable to view the grid view header even the grid view datasource is empty. I am using dotnet framework3.5.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"

                                DataSourceID="odsAccountOpening" EnableModelValidation="True" Height="135px"

                                Width="942px">
                                <Columns>
                                    <asp:BoundField DataField="AccountNo" HeaderText="Account No"

                                        SortExpression="AccountNo" />
                                    <asp:BoundField DataField="SycDepositTypeId" HeaderText="Deposit Type"

                                        SortExpression="SycDepositTypeId" />
                                        <%--<asp:TemplateField HeaderText="Deposit Type">
                                        <ItemTemplate>
                                            <asp:Label ID="lblDepositType1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SycDepositType.DepositTypeName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>--%>
                                    <asp:BoundField DataField="MamAccountHolderTypeId" HeaderText="Account Type"

                                        SortExpression="MamAccountHolderTypeId" />
                                    <asp:BoundField DataField="InterestRate" HeaderText="Interest Rate"

                                        SortExpression="InterestRate" />
                                    <asp:BoundField DataField="AccountOpenOnBs" HeaderText="A/C Opened On"

                                        SortExpression="AccountOpenOnBs" />
                                    <asp:BoundField DataField="MaturityOn" HeaderText="Maturity On"

                                        SortExpression="MaturityOn" />
                                    <asp:BoundField DataField="MamAccountStatusId" HeaderText=" Account Status "

                                        SortExpression="MamAccountStatusId" />
                                </Columns>
                            </asp:GridView>
                            <asp:ObjectDataSource ID="odsAccountOpening" runat="server"

                                OldValuesParameterFormatString="original_{0}"

                                onobjectcreating="odsAccountOpening_ObjectCreating" SelectMethod="GetAll"

                                TypeName="MemberAccountManagement.BLL.CMamAccountOpening">
                            </asp:ObjectDataSource>

解决方案

Hello User,

Set the ShowHeaderWhenEmpty property to true.

Regards,


Here couple of solutions

GridView - Show headers on empty data source[^]


ShowHeaderWhenEmpty="True"

This is the solution for showing header when datasource is empty

Or else you can use Listview.

Hope This helps!!!


这篇关于网格视图标题显示即使gridview数据源为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆