List Info

Thread: RE: New to datagrids question




RE: New to datagrids question
country flaguser name
United States
2007-09-07 12:53:33

Strange as my email showed up to the group actually shows up after your
reply..... wow. I have it all correct now except for one error.

'DataRow' is not a member of 'System.Web.UI.WebControls.DataGridItem'.

which happens on this line:
Dim FileRow As DataRowView = e.Item.DataRow

What I have now is:
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then

Dim FileRow As DataRowView = e.Item.DataRow

Dim FileLink As HyperLink = e.Item.FindControl("FileHyperLink")

Dim FileName As String = FileRow("Name")

FileLink.NavigateUrl = String.Format("http://{0}/",
DomainVariable, FileName)

FileLink.Text = FileRow("Name")

End If

I set the domain variable in code already so that is fine. Sorry about all
the dumb questions, I know much more about repeaters and have used them but
very new to datagrids.

_____

From: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
[mailto: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com] On Behalf Of Dean Fiala
Sent: Friday, September 07, 2007 10:22 AM
To: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
Subject: Re: [AspNetAnyQuestionIsOk] New to datagrids question

DataViewRow
should be
DataRowView

Dim FileLink As HyperLink = e.Item, FindControl("FileHyperLink")
should be
Dim FileLink As HyperLink = e.Item.FindControl("FileHyperLink")

On 9/7/07, mbelcher <AspNetAnyQuestionIs
<mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com>
Ok%40faroutcomputersystems.com">Okfaroutcomputersystems.com> wrote:
&gt;
> Okay I have the following imports:
>
>; Imports System.Data.OleDb
>
> Imports System.Data
>
> Imports System.IO
>
&gt;
>
> I am getting the following 2 errors in the code; trying to figure them out
> as I write this.
&gt;
>
>
>;
>
> If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> ListItemType.AlternatingItem Then
>;
>
>
> Dim FileRow As DataViewRow = e.Item.DataRow
>
> 'Error = Type 'DataViewRow' is not defined.
>
>;
>
>
>
> Dim FileLink As HyperLink = e.Item, FindControl("FileHyperLink")
>
> 'Error = Value of type 'System.Web.UI.WebControls.DataGridItem' cannot be
> converted to 'System.Web.UI.WebControls.HyperLink'.
>
>;
>
>
>
> Dim FileName As String = FileRow(&quot;Name&quot;)
>;
>
>
> FileLink.NavigateUrl = String.Format("http://{0}/",
> DomainVariable, FileName)
>
&gt; FileLink.Text = FileRow(&quot;Name&quot;)
>;
> End If
>
>
&gt;
> The rest of the code is doing fine. This is my first datagrid .......
>
>
>
&gt; _____
&gt;
> From: AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
Ok%40yahoogroups.com">Okyahoogroups.com
&gt; [mailto:AspNetAnyQuestionIs
&lt;mailto:AspNetAnyQuestionIsOk%40yahoogroups.com>; Ok%40yahoogroups.com">Okyahoogroups.com] On
Behalf Of Dean Fiala
&gt; Sent: Wednesday, September 05, 2007 8:46 AM
> To: AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
Ok%40yahoogroups.com">Okyahoogroups.com
&gt; Subject: Re: [AspNetAnyQuestionIsOk] New to datagrids question
>
>;
>
> One reason I avoid the scripting syntax is that this hard to do anything
> fun.
>;
> So, instead, I use the Item_DataBound event as I showed you in my previous
> post. It gets called every time a row is bound to the grid. This is where
&gt; you can make your changes to the URL of every item. You are already
> calling
> the event.
&gt;
> Just change this...
>
> <asp:HyperLink runat=&quot;server&quot; Text='<%# DataBinder.Eval(Container,
&gt; "DataItem.Name&quot;) %>' NavigateUrl='<%# DataBinder.Eval(Container,
&gt; "DataItem.Name&quot;) %>'>
>
&gt; </asp:HyperLink>;
>
> into...
> <asp:HyperLink runat=&quot;server&quot; id="FileHyperLink" />
&gt;
> and change your code in the ItemData_Bound event into something like
>; this...
>
> if e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> ListItemType.AlternatingItem then
>; Dim FileRow as DataViewRow = e.Item.DataRow
> Dim FileLink as HyperLink = e.Item,FindControl(&quot;FileHyperLink&quot;)
> Dim FileName as String = FileRow(&quot;Name&quot;)
>;
> FileLink.NavigateURL = String.Format("http://{0}/", DomainVariable,
>; FileName)
> FileLink.Text = FileRow(&quot;Name&quot;)
>; End if
>
> On 9/4/07, mbelcher <AspNetAnyQuestionIs
> <mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com&gt;
> Okfaroutcomputersy <mailto:Ok%40faroutcomputersystems.com> stems.com&gt;
wrote:
> >
>; > Normally I would set <%# DataBinder.Eval(Container, "DataItem.Name&quot;) %>
&gt; > while filling a dataset with adapter or with a reader and assigning
> values
&gt; > to <%# DataBinder.Eval(Container, "DataItem.Name&quot;) %> as each row is
> read
>; > and rendered. The data grid is confusing me . I never used one before
&gt; > until
&gt; > now.
>; >
>; > so somewhere in here:
&gt; >
>; > articleList.DataSource = dirInfo.GetFiles(&quot;*.*";)
> >
>; >
>; > 'Before I bind somehow I need to make the url = the domain that I am
> > working
> > with. So that is where I am confused. I also was trying to figure out
> how
> > I
> > could just use a datareader and output the files that way with a
> > stringbuilder and making custom html list. I know it is probably easy to
> > use
> > a datagrid but coming from asp classic it feels like osme things are
> just
>; > more difficult in .net. I mean in asp classic making a list of files and
> > modifying alink on output was easy. I search google but find the same
>; info
>; > everywhere and it is usually working with a database and not file
>; > directory
> > contents.....
> >
>; >
>; >
>; >
>; >
>; > articleList.DataBind()
> >
>; >
>; >
>; >
>; >
>; >
>; > I have this in the code behind:
> >
>; >
>; > If Not IsPostBack Then
>; >
>; >
>; >
>; > 'PanelUser.Visible = False
&gt; >
>; > 'PanelAdmin.Visible = False
&gt; >
>; > 'PanelNoAccess.Visible = True
>; >
>; > Dim strFtpFolder
> >
>; > strFtpFolder = Session(&quot;FtpFolder")
> >
>; >
>; >
>; > Dim dirInfo As New DirectoryInfo(strFtpFolder)
&gt; >
>; > 'Dim dirInfo As New DirectoryInfo(Server.MapPath(&quot;"))
> >
>; >
>; >
>; > 'articleList.DataSource = dirInfo.GetFiles(&quot;*.aspx&quot;)
>; >
>; > articleList.DataSource = dirInfo.GetFiles(&quot;*.*";)
> >
>; >
>; >
>; > articleList.DataBind()
> >
>; >
>; >
>; >
>; >
>; >
>; >
>; > End If 'If Not IsPostBack Then
>; >
>; >
>; >
>; >
>; > IN ASPX PAGE SOURCE:
> > '''''''''''''''
&gt; >
>; >
>; > <FORM id="Form1" runat=&quot;server&quot;>
> >
>; >
>; > <asp:label id="lblMessage&quot; runat=&quot;server&quot; ForeColor="Red&quot;
> > Font-Italic="True">;</asp:label>
> >
>; >
>; > <aspataGrid id="articleList&quot; runat=&quot;server&quot; Font-Size="Smaller"
> > OnDeleteCommand=&quot;articleList_DeleteFile"
> >
>; >
>; > OnItemDataBound=&quot;articleList_ItemDataBound"; DataKeyField="FullName&quot;
> > HeaderStyle-Font-Bold="True"
> >
>; >
>; > HeaderStyle-Font-Size="15pt" HeaderStyle-ForeColor="White"
> > HeaderStyle-BackColor="Navy" AlternatingItemStyle-BackColor="#eeeeee"
> >
>; >
>; > AutoGenerateColumns="False" Font-Name="Verdana" Font-Names="Verdana"
> > Width=&quot;615px&quot;>
&gt; >
>; >
>; > <FooterStyle Font-Size="Smaller"&gt;</FooterStyle>
> >
>; >
>; > <AlternatingItemStyle BackColor="#EEEEEE"&gt;</AlternatingItemStyle>
> >
>; >
>; > <HeaderStyle Font-Size="Larger" Font-Bold="True&quot; ForeColor="White"
&gt; > BackColor="Navy&quot;>&lt;/HeaderStyle>
> >
>; >
>; > <Columns>
>; >
>; >
>; > <asp:ButtonColumn Text=";Delete&quot; ButtonType="PushButton&quot;
> > CommandName="Delete"&gt;</asp:ButtonColumn>
> >
>; >
>; > <asp:TemplateColumn HeaderText="File Name">
> >
>; >
>; > <ItemTemplate>
> >
>; >
>; > <asp:HyperLink runat=&quot;server&quot; Text='<%# DataBinder.Eval(Container,
&gt; > "DataItem.Name&quot;) %>' NavigateUrl='<%# DataBinder.Eval(Container,
&gt; > "DataItem.Name&quot;) %>'>
> >
>; >
>; > </asp:HyperLink>;
> >
>; >
>; > </ItemTemplate>
> >
>; >
>; > </asp:TemplateColumn>
&gt; >
>; >
>; > <asp:BoundColumn DataField="LastWriteTime&quot; HeaderText="Last Write Time"
> > DataFormatString=&quot;{0:d}&quot;>
&gt; >
>; >
>; > <ItemStyle HorizontalAlign=&quot;Center&quot;><;/ItemStyle>
> >
>; >
>; > </asp:BoundColumn&gt;
> >
>; >
>; > <asp:BoundColumn DataField="Length" HeaderText="File Size"
> > DataFormatString=&quot;{0:#,### bytes}&quot;>
&gt; >
>; >
>; > <ItemStyle HorizontalAlign=&quot;Right&quot;></ItemStyle&gt;
> >
>; >
>; > </asp:BoundColumn&gt;
> >
>; >
>; > </Columns>
&gt; >
>; >
>; > </aspataGrid>;</FORM>
> >
>; >
>; >
>; > _____
&gt; >
>; > From: AspNetAnyQuestionIs <mailto:
> AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
> Okyahoogroups. <mailto:Ok%40yahoogroups.com> com
> > [mailto:AspNetAnyQuestionIs
&gt; <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt; Okyahoogroups.
<mailto:Ok%40yahoogroups.com> com] On
> Behalf Of Dean Fiala
&gt; > Sent: Thursday, August 30, 2007 10:30 PM
> > To: AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
> Okyahoogroups. <mailto:Ok%40yahoogroups.com> com
> > Subject: Re: [AspNetAnyQuestionIsOk] New to datagrids question
> >
>; >
>; >
>; > If you just put the file name in as the DataNavigateUrlField it will
>; > assume
&gt; > a relative address to your application. If you want to create an
> absolute
> > link you need to specify the full URL.
>; >
>; > The easiest way to do this is make the column a template column, and set
> > the
> > NavigateURL in the Item_DataBound event of the grid. Something like
>; > this...
> >
>; > if e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> > ListItemType.AlternatingItem then
>; > Dim FileRow as DataViewRow = e.Item.DataRow
> > Dim FileLink as HyperLink = e.Item,FindControl(&quot;HyperLinkName&quot;)
> > Dim FileName as String = FileRow(&quot;Name&quot;)
>; >
>; > FileLink.NavigateURL = String.Format("http://{0}/", DomainVariable,
>; > FileName)
> > End if
> >
>; > On 8/30/07, mbelcher <AspNetAnyQuestionIs
> > <mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com&gt;
> > Okfaroutcomputersy <mailto:Ok%40faroutcomputersystems.com> stems.com&gt;
> > wrote:
&gt; > >
>; > > I have a page that lists the contents of a folder. It all works fine.
&gt; > The
> > > thing is that this will also need to allow for the files to be
> > downloaded.
> > > My problem is that I can list up any folder on the server but of
> course
&gt; > > the
> > > hyperlink in the
> > >
>; > > "&quot;"&quot;"&quot;<asp:HyperLinkColumn DataNavigateUrlField="Name"
&gt; > > DataTextField="Name"
> > > HeaderText="File Name"></asp:HyperLinkColumn>"&quot;"&quot;"
> > >
>; > > section will have a URL pointing to the current application. If the
> > > website
> > > where the code is running is www.datagrids.com <http://www.datagrid
> > <http://www.datagrid <http://www.datagrid <http://www.datagrids.com/>
s.com/>; s.com/> s.com/>
> > > then the URL's for the files will be www.datagrids.com/FILENAME no
> > matter
&gt; > > what site the folder contents are actually in. I have a Domain
&gt; Variable
> > > that
>; > > I would like to replace this with. I am getting lsot finding a way to
> do
> > > this within this asp:HyperLinkColumn tag... For instance if the file
>; > name
>; > > is Worktimes.doc ..... How can I make the beginning of the URL the
> value
&gt; > I
> > > have in the domain variable instead of the default which basically is
> > > where
&gt; > > the app is running?
> > >
>; > >
>; > > So instead of the default www.datagrids.com <http://www.datagrid
> > <http://www.datagrid <http://www.datagrid <http://www.datagrids.com/>
s.com/>; s.com/> s.com/> /
> > > Worktimes.doc it will be MyDomianNamevariable/ Worktimes.doc
> > >
>; > >
>; > > Mike
>; > >
>; > >
>; > >
>; > > [Non-text portions of this message have been removed]
> > >
>; > >
>; > >
>; > >
>; > > Yahoo! Groups Links
&gt; > >
>; > >
>; > >
>; > >
>; >
>; > --
> > Dean Fiala
&gt; > Very Practical Software, Inc
> > Now with Blogging...
> > http://www.vpsw. <http://www.vpsw. <http://www.vpsw.
&lt;http://www.vpsw.com/blogbaby&gt; com/blogbaby>
&gt; com/blogbaby> com/blogbaby
> > Microsoft MVP
> >
>; > [Non-text portions of this message have been removed]
> >
>; >
>; >
>; >
>; >
>; > [Non-text portions of this message have been removed]
> >
>; >
>; >
>; >
>; > Yahoo! Groups Links
&gt; >
>; >
>; >
>; >
>;
> --
> Dean Fiala
&gt; Very Practical Software, Inc
> Now with Blogging...
> http://www.vpsw. <http://www.vpsw. <http://www.vpsw.com/blogbaby&gt;
com/blogbaby> com/blogbaby
> Microsoft MVP
>
> [Non-text portions of this message have been removed]
>
>;
>
>
>
> [Non-text portions of this message have been removed]
>
>;
>
>
> Yahoo! Groups Links
&gt;
>
>
>;

--
Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw. <http://www.vpsw.com/blogbaby&gt; com/blogbaby
Microsoft MVP

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: New to datagrids question
country flaguser name
United States
2007-09-07 13:34:47

Dim FileRow As DataRowView = e.Item.DataItem

On 9/7/07, mbelcher < AspNetAnyQuestionIsOk%40faroutcomputersystems.com">AspNetAnyQuestionIsOkfaroutcomputersystems.com> wrote:
&gt;
> Strange as my email showed up to the group actually shows up after your
>; reply..... wow. I have it all correct now except for one error.
&gt;
> 'DataRow' is not a member of 'System.Web.UI.WebControls.DataGridItem'.
>
> which happens on this line:
&gt; Dim FileRow As DataRowView = e.Item.DataRow
>
>
&gt;
> What I have now is:
> If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> ListItemType.AlternatingItem Then
>;
>
>
> Dim FileRow As DataRowView = e.Item.DataRow
>
> Dim FileLink As HyperLink = e.Item.FindControl
> ("FileHyperLink&quot;)
&gt;
>
>
&gt; Dim FileName As String = FileRow(&quot;Name&quot;)
>;
>
>
> FileLink.NavigateUrl = String.Format("http://{0}/",
> DomainVariable, FileName)
>
&gt; FileLink.Text = FileRow(&quot;Name&quot;)
>;
> End If
>
> I set the domain variable in code already so that is fine. Sorry about all
> the dumb questions, I know much more about repeaters and have used them
>; but
> very new to datagrids.
>
&gt;
>
>
&gt;
> _____
&gt;
> From: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
&gt; [mailto: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com] On Behalf Of Dean Fiala
&gt; Sent: Friday, September 07, 2007 10:22 AM
> To: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
&gt; Subject: Re: [AspNetAnyQuestionIsOk] New to datagrids question
>
>;
>
> DataViewRow
> should be
> DataRowView
>
> Dim FileLink As HyperLink = e.Item, FindControl("FileHyperLink")
> should be
> Dim FileLink As HyperLink = e.Item.FindControl(&quot;FileHyperLink&quot;)
>
> On 9/7/07, mbelcher <AspNetAnyQuestionIs
> <mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com&gt;
> Ok%40faroutcomputersystems.com">Okfaroutcomputersystems.com> wrote:
&gt; >
>; > Okay I have the following imports:
> >
>; > Imports System.Data.OleDb
> >
>; > Imports System.Data
> >
>; > Imports System.IO
> >
>; >
>; >
>; > I am getting the following 2 errors in the code; trying to figure them
>; out
> > as I write this.
&gt; >
>; >
>; >
>; >
>; >
>; > If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> > ListItemType.AlternatingItem Then
>; >
>; >
>; >
>; > Dim FileRow As DataViewRow = e.Item.DataRow
> >
>; > 'Error = Type 'DataViewRow' is not defined.
> >
>; >
>; >
>; >
>; >
>; > Dim FileLink As HyperLink = e.Item, FindControl("FileHyperLink")
> >
>; > 'Error = Value of type 'System.Web.UI.WebControls.DataGridItem' cannot
&gt; be
> > converted to 'System.Web.UI.WebControls.HyperLink'.
> >
>; >
>; >
>; >
>; >
>; > Dim FileName As String = FileRow(&quot;Name&quot;)
>; >
>; >
>; >
>; > FileLink.NavigateUrl = String.Format("http://{0}/",
> > DomainVariable, FileName)
> >
>; > FileLink.Text = FileRow(&quot;Name&quot;)
>; >
>; > End If
> >
>; >
>; >
>; > The rest of the code is doing fine. This is my first datagrid .......
> >
>; >
>; >
>; > _____
&gt; >
>; > From: AspNetAnyQuestionIs <mailto:
> AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
> Ok%40yahoogroups.com">Okyahoogroups.com
&gt; > [mailto:AspNetAnyQuestionIs
&gt; <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt; Ok%40yahoogroups.com">Okyahoogroups.com] On
> Behalf Of Dean Fiala
&gt; > Sent: Wednesday, September 05, 2007 8:46 AM
> > To: AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
> Ok%40yahoogroups.com">Okyahoogroups.com
&gt; > Subject: Re: [AspNetAnyQuestionIsOk] New to datagrids question
> >
>; >
>; >
>; > One reason I avoid the scripting syntax is that this hard to do anything
> > fun.
>; >
>; > So, instead, I use the Item_DataBound event as I showed you in my
> previous
> > post. It gets called every time a row is bound to the grid. This is
> where
&gt; > you can make your changes to the URL of every item. You are already
> > calling
> > the event.
&gt; >
>; > Just change this...
> >
>; > <asp:HyperLink runat=&quot;server&quot; Text='<%# DataBinder.Eval(Container,
&gt; > "DataItem.Name&quot;) %>' NavigateUrl='<%# DataBinder.Eval(Container,
&gt; > "DataItem.Name&quot;) %>'>
> >
>; > </asp:HyperLink>;
> >
>; > into...
> > <asp:HyperLink runat=&quot;server&quot; id="FileHyperLink" />
&gt; >
>; > and change your code in the ItemData_Bound event into something like
>; > this...
> >
>; > if e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> > ListItemType.AlternatingItem then
>; > Dim FileRow as DataViewRow = e.Item.DataRow
> > Dim FileLink as HyperLink = e.Item,FindControl(&quot;FileHyperLink&quot;)
> > Dim FileName as String = FileRow(&quot;Name&quot;)
>; >
>; > FileLink.NavigateURL = String.Format("http://{0}/", DomainVariable,
>; > FileName)
> > FileLink.Text = FileRow(&quot;Name&quot;)
>; > End if
> >
>; > On 9/4/07, mbelcher <AspNetAnyQuestionIs
> > <mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com&gt;
> > Okfaroutcomputersy <mailto:Ok%40faroutcomputersystems.com> stems.com&gt;
> wrote:
&gt; > >
>; > > Normally I would set <%# DataBinder.Eval(Container, "DataItem.Name&quot;)
&gt; %>
&gt; > > while filling a dataset with adapter or with a reader and assigning
> > values
&gt; > > to <%# DataBinder.Eval(Container, "DataItem.Name&quot;) %> as each row is
> > read
>; > > and rendered. The data grid is confusing me . I never used one before
&gt; > > until
&gt; > > now.
>; > >
>; > > so somewhere in here:
&gt; > >
>; > > articleList.DataSource = dirInfo.GetFiles(&quot;*.*";)
> > >
>; > >
>; > > 'Before I bind somehow I need to make the url = the domain that I am
> > > working
> > > with. So that is where I am confused. I also was trying to figure out
> > how
> > > I
> > > could just use a datareader and output the files that way with a
> > > stringbuilder and making custom html list. I know it is probably easy
>; to
> > > use
> > > a datagrid but coming from asp classic it feels like osme things are
> > just
>; > > more difficult in .net. I mean in asp classic making a list of files
&gt; and
> > > modifying alink on output was easy. I search google but find the same
>; > info
>; > > everywhere and it is usually working with a database and not file
>; > > directory
> > > contents.....
> > >
>; > >
>; > >
>; > >
>; > >
>; > > articleList.DataBind()
> > >
>; > >
>; > >
>; > >
>; > >
>; > >
>; > > I have this in the code behind:
> > >
>; > >
>; > > If Not IsPostBack Then
>; > >
>; > >
>; > >
>; > > 'PanelUser.Visible = False
&gt; > >
>; > > 'PanelAdmin.Visible = False
&gt; > >
>; > > 'PanelNoAccess.Visible = True
>; > >
>; > > Dim strFtpFolder
> > >
>; > > strFtpFolder = Session(&quot;FtpFolder")
> > >
>; > >
>; > >
>; > > Dim dirInfo As New DirectoryInfo(strFtpFolder)
&gt; > >
>; > > 'Dim dirInfo As New DirectoryInfo(Server.MapPath(&quot;"))
> > >
>; > >
>; > >
>; > > 'articleList.DataSource = dirInfo.GetFiles(&quot;*.aspx&quot;)
>; > >
>; > > articleList.DataSource = dirInfo.GetFiles(&quot;*.*";)
> > >
>; > >
>; > >
>; > > articleList.DataBind()
> > >
>; > >
>; > >
>; > >
>; > >
>; > >
>; > >
>; > > End If 'If Not IsPostBack Then
>; > >
>; > >
>; > >
>; > >
>; > > IN ASPX PAGE SOURCE:
> > > '''''''''''''''
&gt; > >
>; > >
>; > > <FORM id="Form1" runat=&quot;server&quot;>
> > >
>; > >
>; > > <asp:label id="lblMessage&quot; runat=&quot;server&quot; ForeColor="Red&quot;
> > > Font-Italic="True">;</asp:label>
> > >
>; > >
>; > > <aspataGrid id="articleList&quot; runat=&quot;server&quot; Font-Size="Smaller"
> > > OnDeleteCommand=&quot;articleList_DeleteFile"
> > >
>; > >
>; > > OnItemDataBound=&quot;articleList_ItemDataBound"; DataKeyField="FullName&quot;
> > > HeaderStyle-Font-Bold="True"
> > >
>; > >
>; > > HeaderStyle-Font-Size="15pt" HeaderStyle-ForeColor="White"
> > > HeaderStyle-BackColor="Navy" AlternatingItemStyle-BackColor="#eeeeee"
> > >
>; > >
>; > > AutoGenerateColumns="False" Font-Name="Verdana" Font-Names="Verdana"
> > > Width=&quot;615px&quot;>
&gt; > >
>; > >
>; > > <FooterStyle Font-Size="Smaller"&gt;</FooterStyle>
> > >
>; > >
>; > > <AlternatingItemStyle BackColor="#EEEEEE"&gt;</AlternatingItemStyle>
> > >
>; > >
>; > > <HeaderStyle Font-Size="Larger" Font-Bold="True&quot; ForeColor="White"
&gt; > > BackColor="Navy&quot;>&lt;/HeaderStyle>
> > >
>; > >
>; > > <Columns>
>; > >
>; > >
>; > > <asp:ButtonColumn Text=";Delete&quot; ButtonType="PushButton&quot;
> > > CommandName="Delete"&gt;</asp:ButtonColumn>
> > >
>; > >
>; > > <asp:TemplateColumn HeaderText="File Name">
> > >
>; > >
>; > > <ItemTemplate>
> > >
>; > >
>; > > <asp:HyperLink runat=&quot;server&quot; Text='<%# DataBinder.Eval(Container,
&gt; > > "DataItem.Name&quot;) %>' NavigateUrl='<%# DataBinder.Eval(Container,
&gt; > > "DataItem.Name&quot;) %>'>
> > >
>; > >
>; > > </asp:HyperLink>;
> > >
>; > >
>; > > </ItemTemplate>
> > >
>; > >
>; > > </asp:TemplateColumn>
&gt; > >
>; > >
>; > > <asp:BoundColumn DataField="LastWriteTime&quot; HeaderText="Last Write
&gt; Time"
> > > DataFormatString=&quot;{0:d}&quot;>
&gt; > >
>; > >
>; > > <ItemStyle HorizontalAlign=&quot;Center&quot;><;/ItemStyle>
> > >
>; > >
>; > > </asp:BoundColumn&gt;
> > >
>; > >
>; > > <asp:BoundColumn DataField="Length" HeaderText="File Size"
> > > DataFormatString=&quot;{0:#,### bytes}&quot;>
&gt; > >
>; > >
>; > > <ItemStyle HorizontalAlign=&quot;Right&quot;></ItemStyle&gt;
> > >
>; > >
>; > > </asp:BoundColumn&gt;
> > >
>; > >
>; > > </Columns>
&gt; > >
>; > >
>; > > </aspataGrid>;</FORM>
> > >
>; > >
>; > >
>; > > _____
&gt; > >
>; > > From: AspNetAnyQuestionIs <mailto:
> > AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
> > Okyahoogroups. <mailto:Ok%40yahoogroups.com> com
> > > [mailto:AspNetAnyQuestionIs
&gt; > <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt; Okyahoogroups.
> <mailto:Ok%40yahoogroups.com> com] On
> > Behalf Of Dean Fiala
&gt; > > Sent: Thursday, August 30, 2007 10:30 PM
> > > To: AspNetAnyQuestionIs <mailto:
> AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
> > Okyahoogroups. <mailto:Ok%40yahoogroups.com> com
> > > Subject: Re: [AspNetAnyQuestionIsOk] New to datagrids question
> > >
>; > >
>; > >
>; > > If you just put the file name in as the DataNavigateUrlField it will
>; > > assume
&gt; > > a relative address to your application. If you want to create an
> > absolute
> > > link you need to specify the full URL.
>; > >
>; > > The easiest way to do this is make the column a template column, and
> set
> > > the
> > > NavigateURL in the Item_DataBound event of the grid. Something like
>; > > this...
> > >
>; > > if e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
> > > ListItemType.AlternatingItem then
>; > > Dim FileRow as DataViewRow = e.Item.DataRow
> > > Dim FileLink as HyperLink = e.Item,FindControl(&quot;HyperLinkName&quot;)
> > > Dim FileName as String = FileRow(&quot;Name&quot;)
>; > >
>; > > FileLink.NavigateURL = String.Format("http://{0}/", DomainVariable,
>; > > FileName)
> > > End if
> > >
>; > > On 8/30/07, mbelcher <AspNetAnyQuestionIs
> > > <mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com&gt;
> > > Okfaroutcomputersy <mailto:Ok%40faroutcomputersystems.com> stems.com&gt;
> > > wrote:
&gt; > > >
>; > > > I have a page that lists the contents of a folder. It all works
&gt; fine.
&gt; > > The
> > > > thing is that this will also need to allow for the files to be
> > > downloaded.
> > > > My problem is that I can list up any folder on the server but of
> > course
&gt; > > > the
> > > > hyperlink in the
> > > >
>; > > > "&quot;"&quot;"&quot;<asp:HyperLinkColumn DataNavigateUrlField="Name"
&gt; > > > DataTextField="Name"
> > > > HeaderText="File Name"></asp:HyperLinkColumn>"&quot;"&quot;"
> > > >
>; > > > section will have a URL pointing to the current application. If the
> > > > website
> > > > where the code is running is www.datagrids.com <http://www.datagrid
> > > <http://www.datagrid <http://www.datagrid <http://www.datagrids.com/>
> s.com/> s.com/> s.com/>
> > > > then the URL's for the files will be www.datagrids.com/FILENAME no
> > > matter
&gt; > > > what site the folder contents are actually in. I have a Domain
&gt; > Variable
> > > > that
>; > > > I would like to replace this with. I am getting lsot finding a way
> to
> > do
> > > > this within this asp:HyperLinkColumn tag... For instance if the file
>; > > name
>; > > > is Worktimes.doc ..... How can I make the beginning of the URL the
> > value
&gt; > > I
> > > > have in the domain variable instead of the default which basically
> is
> > > > where
&gt; > > > the app is running?
> > > >
>; > > >
>; > > > So instead of the default www.datagrids.com <http://www.datagrid
> > > <http://www.datagrid <http://www.datagrid <http://www.datagrids.com/>
> s.com/> s.com/> s.com/> /
> > > > Worktimes.doc it will be MyDomianNamevariable/ Worktimes.doc
> > > >
>; > > >
>; > > > Mike
>; > > >
>; > > >
>; > > >
>; > > > [Non-text portions of this message have been removed]
> > > >
>; > > >
>; > > >
>; > > >
>; > > > Yahoo! Groups Links
&gt; > > >
>; > > >
>; > > >
>; > > >
>; > >
>; > > --
> > > Dean Fiala
&gt; > > Very Practical Software, Inc
> > > Now with Blogging...
> > > http://www.vpsw. <http://www.vpsw. <http://www.vpsw.
&gt; <http://www.vpsw.com/blogbaby&gt; com/blogbaby>
&gt; > com/blogbaby> com/blogbaby
> > > Microsoft MVP
> > >
>; > > [Non-text portions of this message have been removed]
> > >
>; > >
>; > >
>; > >
>; > >
>; > > [Non-text portions of this message have been removed]
> > >
>; > >
>; > >
>; > >
>; > > Yahoo! Groups Links
&gt; > >
>; > >
>; > >
>; > >
>; >
>; > --
> > Dean Fiala
&gt; > Very Practical Software, Inc
> > Now with Blogging...
> > http://www.vpsw. <http://www.vpsw. <http://www.vpsw.com/blogbaby&gt;
> com/blogbaby> com/blogbaby
> > Microsoft MVP
> >
>; > [Non-text portions of this message have been removed]
> >
>; >
>; >
>; >
>; >
>; > [Non-text portions of this message have been removed]
> >
>; >
>; >
>; >
>; > Yahoo! Groups Links
&gt; >
>; >
>; >
>; >
>;
> --
> Dean Fiala
&gt; Very Practical Software, Inc
> Now with Blogging...
> http://www.vpsw. <http://www.vpsw.com/blogbaby&gt; com/blogbaby
> Microsoft MVP
>
> [Non-text portions of this message have been removed]
>
>;
>
>
>
> [Non-text portions of this message have been removed]
>
>;
>
>
> Yahoo! Groups Links
&gt;
>
>
>;

--
Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )