Welcome Guest Search | Active Topics | Sign In | Register

show text in EO.web grid when no data available Options
grchen168
Posted: Monday, March 14, 2022 1:57:32 AM
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?



eo_support
Posted: Tuesday, March 15, 2022 3:15:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

You would set the Grid's EmptyDataText property.

Thanks!
grchen168
Posted: Tuesday, March 15, 2022 3:58:54 AM
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 ??
eo_support
Posted: Tuesday, March 15, 2022 4:10:11 PM
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!
grchen168
Posted: Tuesday, March 15, 2022 11:30:22 PM
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?

grchen168
Posted: Tuesday, March 15, 2022 11:34:47 PM
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.
eo_support
Posted: Wednesday, March 16, 2022 10:47:05 AM
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!
grchen168
Posted: Wednesday, March 16, 2022 11:04:19 AM
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.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.