interviews.dotnetthread.com

↑ Grab this Headline Animator

Tuesday, September 16, 2008

Difference between DropDownList.Items.Add and DropDownList.Items.Insert method

DropDownList.Items.Add method allows you to add new ListItem into the DropDownList. This item will be added as the last item of the DropDownList.


CodedropDownList.Items.Add(new ListItem("Default Panel", "0"));

DropDownList.Items.Insert method allows you to specify the index of the item within the DropDownList where you want to insert the ListItem.


CodedropDownList.Items.Insert(0, new ListItem("Default Panel", "0"));

Here Default Value will be added as the first item in the DropDown.

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles