I think first you need to understand how web applications works, ASP.NET does not maintain state, you have loaded the dataset from database in the not isPostback of the page load.
When user perfoms any operation on the page and perform the postback then the data present in your dataset is lost, it contains nothing, that’s why you are not getting any data in the dropdown list.
Member 6967450 wrote:
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
populatedata();
}
} catch (Exception ex) { } }
You can do any one of the following options.
1- Persist the data present the the dataset by storing it into viewstate or session (Not a good approach if your userbase is big or the data is huge)
2- To bind the dropdown list, load the data again from the database