I am trying to redirect to error page if the Listview is empty. I did try below workaround but doesn't seems to redirect.
protected void lvDetils_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.EmptyItem)
{
Response.RedirectToRoutePermanent("NotFound");
}
}
What is wrong with this? Is it possible to do like that?