Hi All,
I have asp.net website with dropdownlist containing list of Titles (Mr, Mrs, Miss etc). What is happening, everytime the page is loaded, dropdownlist is populated with the same data resulting in creating depulicates. I want the data to load just once into
the dropdownlist, not everytime.
My code is below ... Code behind
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadTitles();
}
}
private void LoadTitles()
{
TitleDropDownList.Items.Clear();
TitleDropDownList.DataSource = LoadListData.GetAllTitles();
TitleDropDownList.DataValueField = "TitleDescription";
TitleDropDownList.DataTextField = "TitleDescription";
TitleDropDownList.DataBind();
}
Screenshot
Thanks in advance.
Regards ...
Go to the complete details ...