How to Clear DropDownList Selected Item in ASP.Net C#

DropDownList Clear


DropDownList All Item Values Remove


C# Coding


  protected void Button1_Click(object sender, EventArgs e)
    {
        DropDownList1.SelectedIndex = -1;

    }


First - Add DropDownList to Webform & Insert Item Values(country) 








Next - Clear Button - Double Click Write Coding


  



Next - Press F5 Run the Program

Select One Country







After  - Click the  Button  Index Go to -1  Display First Index (select country)  Display







0 comments:

Post a Comment