Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Displaying all the aspx page in dropdownlist

Code as follows
C#
 string sourceDirectory = Server.MapPath("~/");
 DirectoryInfo directoryInfo = new DirectoryInfo(sourceDirectory);
 var aspxFiles = new List<string>   (Directory.GetFiles(sourceDirectory,"*.aspx",SearchOption.AllDirectories));
for (int i = 0;i<aspxfiles.count;>     {
       string[] smsg = aspxFiles[i].Split('\\');
       int a = smsg.Count();
       sourceDirectory = smsg[a - 1].ToString().Trim();
       this.dropdownlist1.Items.Add(sourceDirectory);
   }

from the above code displaying all the aspx page into dropdownlist

i have one folder called Employee.

in Employee folder Two aspx page as follows

Emplogin.aspx and Empmaster.aspx

In the dropdownlist1 i am displaying .aspx page. but i dont want to show the above Employee folder two aspx page

Emplogin.aspx and Empmaster.aspx dont want to show in the dropdownlist1.


for that how can i do in asp.net using c#.
Posted
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900