Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid and DirectoryInfo?

Status
Not open for further replies.

talenx

Programmer
Aug 7, 2001
157
US
Hello,

I have been working on a File Portal for my companies intranet. currently I can populate the FOLDER and FILE list within a html table but for some reason I can get the datasource to accept multiple dataset.



here is my code:

as you can see in my code I can populate the DataGrid with one or the other. but not both at the same time. basically I need to be able to display ALL folders of a directory and following ALL files. ( Windows Explore style.)




Code:
<%@ Page Language="vb" %>
<%@ import Namespace="System.IO" %>
<script runat="server">

	Sub Page_Load(sender as Object, e as EventArgs)
	  Dim strDir= (Server.MapPath(""))


	  Dim DirInfo As New DirectoryInfo(strDir)

	 FolderGrid1.DataSource = DirInfo.GetDirectories("*.*")
	 'FileGrid1.DataSource = dirInfo.GetFiles("*.*")
	 FolderGrid1.DataBind()
	 'FileGrid1.DataBind()

	End Sub

</script>
<html>
<head>
</head>
<body>
	<form runat="server">
		<ASP:DataGrid id="FolderGrid1" runat="server" AlternatingItemStyle-BackColor="#eeeeee" Font-Names="Verdana" BorderColor="Black" BorderWidth="1px" CellPadding="3" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" AutoGenerateColumns="False">
			<HeaderStyle backcolor="#AAAADD"></HeaderStyle>
			<PagerStyle mode="NumericPages"></PagerStyle>
			<AlternatingItemStyle backcolor="#EEEEEE"></AlternatingItemStyle>
			<Columns>
				<asp:TemplateColumn>
					<ItemTemplate>
						<img align="top" src="t_txt.gif" />
					</ItemTemplate>
				</asp:TemplateColumn>
				<asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="Name"></asp:HyperLinkColumn>
				<asp:BoundColumn DataField="LastWriteTime" HeaderText="Modified Date" DataFormatString="{0:d}">
					<ItemStyle horizontalalign="Center"></ItemStyle>
				</asp:BoundColumn>
			</Columns>
		</ASP:DataGrid>
	</form>
</body>
</html>







any thoughts

thanks

talenx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top