narasiman rao

narasiman rao

  • NA
  • 519
  • 769.1k

how to split a string in C#

Nov 27 2015 5:30 AM
 
  I am displaying all the project name in dropdownlist as follows

string sourceDirectory = Server.MapPath("~/");
DirectoryInfo directoryInfo = new DirectoryInfo(sourceDirectory);
var aspxFiles = new List(Directory.GetFiles(sourceDirectory, "*.aspx", SearchOption.AllDirectories));

foreach (string currentFile in aspxFiles)
{
this.ddllink.Items.Add(currentFile);
}

When i run in dropdownlist output as follows

E:Projects\Reception\Default.aspx


But i want in dropdownlist as follows Default.aspx

i want to split after \.

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

In dropdownlist i want output as follows
Default.aspx
 

Answers (4)