Reputation: 150
i have asp GridView
<asp:GridView ID="uploadedSoundDataGridView" runat="server" AutoGenerateColumns="false" EmptyDataText = "No files uploaded"/>
and some code on pageload to display files in a directory
if (!IsPostBack)
{
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Uploads/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
files.Add(new ListItem(Path.GetFileName(filePath), filePath));
}
uploadedSoundDataGridView.DataSource = files;
uploadedSoundDataGridView.DataBind();
}
I can take all file names and i can bind them to GridView(i checked it with quickwatch). But in my page i cant see GridView. Does anyone tell me why? Thank you
Upvotes: 1
Views: 81
Reputation: 2413
In your gridview change this property :
AutoGenerateColumns = "false"
to :
AutoGenerateColumns = "true"
Upvotes: 1