简体   繁体   中英

GridView is not shown in the content page

I have a gridview in my Master page.I have taken an item template inside it. 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. when i deleted gridview and put some simple text in place of it ,it's working .

i tried setting z- index and some peculiar things but nothing seems to work.Please help me out

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

Confirm the below cases to show the gridview, listed below:

a. Must have to put "DataSource" and then call DataBind() method, like

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

b. Data must exists in the "DataSource" c. Locate data field( <%# Eval("DataFieldName") %> ) to Gridview column, like in aspx code c. Make it visible (or don't make invisible, by default it is true) d. If you use CssClass, then make sure there has "display:block;" or has no "display:none;"

Hope these would be very helpful.

Try setting the EmptyDataText to something and see if it shows the text. If it does, it means it is not DataBound to anything, or the DataSource has no rows. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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