Here i have a problem with to list the search files into the listbox according to the date modified. The below code is shows only list the search files into the listbox. Could anyone help me how settle this problem please.....
protected void Button1_Click(object sender, EventArgs e)
{
ListBox1.Items.Clear();
string search = TextBox1.Text; // here type the folder name
if (search != "")
//DirectoryInfo d = new DirectoryInfo(@"\\192.123.1.18\Report\Result" + search);
{
string[] files = Directory.GetFiles(@"\\192.123.1.16\Report\Result\"+ search, "*.txt", SearchOption.AllDirectories);
foreach (string file in files)
{
//ListBox1.Items.Add(new ListItem(Path.GetFileName(file), file));
ListBox1.Items.Add(new ListItem(Path.GetFileName(file), file)); // listed all files in the search folder
}
{
search = "";
}
}
else
{
Response.Write("<script>alert('Please Enter Search Keyword');</script>");
}
}