Error In Opening Files From DataGrid.
-
Hi!! I have Binded list of files from a directory into datagrid. i have also added an hyperlink to the datagrid so that the particular file will open after clicking it. But when i do so i get an error message as follows.. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /TestMain/Needle brg and oil seal pressing.pdf THE PAGE_LOAD CODE IS protected void Page_Load(object sender, EventArgs e) { try { //String[] f = Directory.GetFiles("c:/gearfactory"); dir = new DirectoryInfo(Server.MapPath("~/gearfactory")); articleList.DataSource = dir.GetFiles("*.pdf"); //articleList.DataSource = f; articleList.DataBind(); } catch (Exception ex) { Response.Write("Error :-" + ex); } } THE DATAGRID SOURCE CODE IS <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name" /> <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" /> <asp:BoundColumn DataField="Length" HeaderText="File Size" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,### bytes}" /> </Columns> </asp:DataGrid> Can some one help me with this. Thank you in advance. Ashish.