User159294348 posted
I have this code in default.aspx:
<asp:GridView
ID="GridView1"
Runat="server"
DataSource='<%#
GetData() %>'
AutoGenerateColumns="False">
<asp:BoundField
HeaderText="Num"
DataField="NumID">
<ItemStyle
HorizontalAlign="Center"
VerticalAlign="Middle"></ItemStyle></asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink
ID="MovieLink"
runat="server"
HeaderText="MovieURL"
style="border-style:
none"
ControlStyle-Height="150"
ControlStyle-Width="105"
NavigateUrl=""
Target="">MovieLink</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Here
is my default.aspx.vb code behind:
Function
GetData() As DataTable
Dim dt as New DataTable()
dir
As
New
IO.DirectoryInfo(MovieImagesPath)
Dim
dirInfo As
IO.DirectoryInfo()
= dir.GetDirectories()
Dim
dir2 As
IO.DirectoryInfo
dt.Columns.Add(New
DataColumn("NumID",
GetType(Integer)))
Dim Num as Integer
Dim dr
As
DataRow
= dt.NewRow()
'list
the names of all Movie Name directories in the Movie directory
For
Each
dir2 In
dirInfo
Num = Num + 1
dr("NumID")
= Num
dr("MovieLink").NavigateUrl = ResolveUrl(GetMovieImage(dir2.ToString)
dr("MovieLink").ImageUrl = ResolveUrl(GetMovieImage(dir2.ToString)
dt.Rows.Add(dr)
dr = dt.NewRow()
Next
dt.Rows.Add(dr)
Return
dt
End
Function
MY
QUESTIONS ARE :
Why
the "dr("MovieLink").NavigateUrl" and "dr("MovieLink").ImageUrl" do not work?
Looks
like it cannot found inside the templateitem.
It
list the directory for all the mp4 files just fine when I comment this 2 lines out.
I
want to be able to see the small thumbnails image on the gridview list and when I click on it will show the details page on the NavigateURL link.
I
want to do all the dynamically in codebehind for any new MP4 files, thumbnails images and URL links for details of movies.
Any
help will be appreciated.