---
title: "How to remove duplicate item from DropDownList in asp.net"  
description: "In this small blog i am going to demonstrate how to remove duplicate item from dropdownlist in asp.net.Create a sample page in Vs, Drag a dropdownlist"  
author: "Ashok Aryan"  
published: 2016-02-19  
updated: 2018-03-14  
canonical: https://www.mindstick.com/blog/11023/how-to-remove-duplicate-item-from-dropdownlist-in-asp-dot-net  
category: "c#"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# How to remove duplicate item from DropDownList in asp.net

In this small [blog](https://www.mindstick.com/articles/12705/myths-and-misconception-about-blog) i am going to demonstrate how to [remove duplicate](https://www.mindstick.com/forum/157765/how-to-remove-duplicate-rows-in-sql) [item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript) from [dropdownlist](https://www.mindstick.com/articles/324837/how-to-bind-dropdownlist-in-mvc-core-from-database-using-entity-framework) in asp.net.Create a [sample](https://www.mindstick.com/news/2174/mars-mission-by-nasa-prepares-for-tests) [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page) in Vs, Drag a dropdownlist [put](https://answers.mindstick.com/qa/111890/can-you-explain-the-difference-between-put-and-post-http-methods) some item like below![How to remove duplicate item from DropDownList in asp.net](https://www.mindstick.com/blogs/1fc10c2e-cedc-43fd-ae3c-0b0f72b69518/images/9bb20bfb-7673-430c-af94-2f9f7fc7aa1d.png)\
\
Now Call the below code snippet to remove duplicate items from dropdownlist\

##### code snippet

\

```
  void RemoveDuplicateItems(DropDownList ddl)    {        for (int i = 0; i < ddl.Items.Count; i++)        {            ddl.SelectedIndex = i;            string str = ddl.SelectedItem.ToString();            for (int counter = i + 1; counter < ddl.Items.Count; counter++)            {                ddl.SelectedIndex = counter;                string compareStr = ddl.SelectedItem.ToString();                if (str == compareStr)                {                    ddl.Items.RemoveAt(counter);                    counter = counter - 1;                }            }        }    }
```

\

##### Results

**\**![How to remove duplicate item from DropDownList in asp.net](https://www.mindstick.com/blogs/1fc10c2e-cedc-43fd-ae3c-0b0f72b69518/images/eb4e7685-7cef-40d4-8270-6f5e1249360a.png)**\****\****\**\

---

Original Source: https://www.mindstick.com/blog/11023/how-to-remove-duplicate-item-from-dropdownlist-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
