Hi Karthik!
Does NOT work for me. I am getting this DataBinding error message when I tried your code. Can you please help? See my code, below.
DataBinding: 'System.Web.UI.WebControls.ListItem' does not contain a property with the name....
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] filePaths = Directory.GetFiles(Server.MapPath("../Files/"));
List<listitem> files = new List<listitem>();
foreach (string filePath in filePaths)
{
files.Add(new ListItem(Path.GetFileName(filePath), filePath));
}
FileGrid.DataSource = files;
FileGrid.DataBind();
}
}