|
Rank: Advanced Member Groups: Member
Joined: 8/26/2021 Posts: 47
|
Using EO.Web Grid, how to show a text, like "No Data Available", in the main content area of the grid, when there is no any items in bounded data source?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
You would set the Grid's EmptyDataText property.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/26/2021 Posts: 47
|
Thanks!
One minor related question: Is it possible to centrally put the EmptyDataText string in the middle? Or , can I use html markup for the EmptyDataText ??
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
EmptyDataText is HTML. So you can use any HTML code. It is easy to display some HTML text in the center if the Grid's size is fixed. You can simply hardcode some HTML that display the data in the middle.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/26/2021 Posts: 47
|
Hi, Thanks for reply.
But, for a grid with fixed width (ex: 500px), I use the following : EmptyDataText="<center>No Data!!</center>" in the grid's html markup, the result is the text is still left aligned. Am I missing something?
|
|
Rank: Advanced Member Groups: Member
Joined: 8/26/2021 Posts: 47
|
BTW, I also try: EmptyDataText="<p style='text-align:center;'>Center this text!</p>" But, still of no use.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, There is nothing for you to align to if you don't have a width/height first. Try something like this:
Code: HTML/ASPX
<div style='text-align:center;width:500px;padding-top:100px;'>No Data!</div>
Note the width CSS attribute defines the total width so that "center" is relative to that 500px. Additionally, there is a "padding-top" to push the text down vertically. In the future you can search online on such issues and you should be able to find plenty of information about those. We are actually not in a position to provide support on generic HTML syntax. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/26/2021 Posts: 47
|
Yes there are many info on the net teaching how to center text in div within general html web page context. But as far as eo.grid is concerned, I thought the div for the EmptyDataText will honor the parent eo.grid's width!! Anyway, base on your answer, we now know that it still need to specify width in the style for EmptyDataText markup.
|
|