Add static items(more than 100) in List in less than 10 Sec using Visual Studio

Sometime the task is done quickly using regular expression. "Find & Replace" with "Regular Expression" !!! What's Combination Amazing!!! and can save our time to do huge boring tasks in few seconds.


Generally we are given an excel sheet and said that this column should be appear in drop down list and these are static then How can we insert items quickly
1. Copy Excel Sheet Column which is to be appeared in dropdownlist or Items from text file and Paste in source code file.
2. Select all items.
3. In Visual Studio -> Edit -> Find and Replace and put following thing
Find What: {.+}
Look in: Selection
Use: Regular Expression
Replace With:
<li>\1</li> (HTML List)
<option>\1</option>(HTML Drop Down)
<asp:ListItem>\1</asp:ListItem> (ASP.NET Listbox and DropDown Items)
4. Add Start tag and end tag of control before and after selection.


Don’t forget to say Thanks If it helps.

No comments:

Post a Comment