I have a listview which bind data on selected country value dropdownlist from sharepoint diffrent lists by country, sometimes the list is empty so I add :
<EmptyDataTemplate>
<div>No records found. </div>
</EmptyDataTemplate>
Scenario:
from Dropdownlist(countries list), I choose an empty list (country 1), it displays "No records found"
from Dropdownlist, I choose a non empty list (country 2), it displays the records
So I don't know why in step 3 when I turn back to (country 1) or even if I choose another empty country list it still display the records from non empty list. Help Please.
You need to rebind the gridview to an empty data source when the country is empty.
if(countryHasNoRecords)
{
gvMyGridView.DataSource = null;
gvMyGridView.DataBind();
}