简体   繁体   English

GridView未显示在内容页面中

[英]GridView is not shown in the content page

I have a gridview in my Master page.I have taken an item template inside it. 我的主页面上有一个gridview。我在里面有一个项目模板。 I have given some text to the controls initially. 我最初给控件一些文字。 In the design view of the content page gridview is visible but while running the page it's not showing gridview. 在内容页面的设计视图中,gridview是可见的,但在运行页面时,它不显示gridview。 when i deleted gridview and put some simple text in place of it ,it's working . 当我删除gridview并放置一些简单的文本代替它时,它正在工作。

i tried setting z- index and some peculiar things but nothing seems to work.Please help me out 我尝试设置z-index和一些特殊的东西但似乎什么都没有用。请帮帮我

可能有多种原因 - 您可能无法绑定它或datasource为空或其hidden可见性状态,或者您已在ContantPlaceHolder中的ContantPlaceHolder中放置了GridView

Confirm the below cases to show the gridview, listed below: 确认以下案例以显示gridview,如下所示:

a. 一种。 Must have to put "DataSource" and then call DataBind() method, like 必须要把“DataSource”然后再调用DataBind()方法

gridViewToShow.DataSource = dataSourceName; // may be table or custom data source
gridViewToShow.DataBind();

b. Data must exists in the "DataSource" c. 数据必须存在于“DataSource”c中。 Locate data field( <%# Eval("DataFieldName") %> ) to Gridview column, like in aspx code c. 将数据字段(<%#Eval(“DataFieldName”)%>)定位到Gridview列,就像在aspx代码c中一样。 Make it visible (or don't make invisible, by default it is true) d. 让它可见(或不要隐藏,默认情况下是真的)d。 If you use CssClass, then make sure there has "display:block;" 如果你使用CssClass,那么确保有“display:block;” or has no "display:none;" 或者没有“display:none;”

Hope these would be very helpful. 希望这些会非常有帮助。

Try setting the EmptyDataText to something and see if it shows the text. 尝试将EmptyDataText设置为某个内容并查看它是否显示文本。 If it does, it means it is not DataBound to anything, or the DataSource has no rows. 如果是这样,则意味着它不是DataBound ,或者DataSource没有行。 Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM