I can't seem to get either EmptyDataTemplate
or EmptyDataText
of a GridView
to work.
I'm fetching the GridView
contents in de codebehind and attaching them with using DataBind()
. I've tried having them as null
and as an empty List
, and in both cases the text I put into EmptyDataTemplate
or EmptyDataText
is not displayed.
What am I doing wrong?
EDIT (Code snippet)
This is my GridView:
<asp:GridView ID="grid" runat="server" EmptyDataText="EMPTY">
</asp:GridView>
And I've tried these two for binding the data:
grid.DataSource = new List<object>();
grid.DataBind();
grid.DataSource = null;
grid.DataBind();