User1510859543 posted
I am trying to conditionally change the message that displays when a ListView datasource returns no data. My EmptyDataTemplate is shown below.
<EmptyDataTemplate>
<table id="Table1" runat="server">
<tr>
<td> </td>
</tr>
<tr>
<td class="nodata">
<asp:Label ID="LblNoData" runat="server" Text="This client has no meals. Select one of these options to create meals."></asp:Label>
</td>
</tr>
</table>
</EmptyDataTemplate>
I have tried code similar to below in the Databound, Itemdatabaound and Prerender events with no success.
If Not lvActualMeals.FindControl("LblNoData") Is Nothing Then
If txtSearchFor.Text <> "" Then
Dim lbl As Label = CType(lvActualMeals.FindControl("LblNoData"), Label)
lbl.Text = "The item you searched for was not found in these meals."
End If
End If