narasiman rao

narasiman rao

  • NA
  • 519
  • 767.2k

Displaying all the aspx project into dropdownlist

Dec 31 2015 1:03 AM
 
    Displaying all the aspx page in dropdownlist

   Code as follows 
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#.



Answers (1)