I have a very simple FormView control, but when I view the page it does not
show the Paging controls, although it does show the data. Here is my code:
<%@ Page Language="vb" AutoEventWireup ="false"
CodeBehind="For mViewTest.aspx. vb" Inherits="famil y.FormViewTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:FormView ID="fviewTestin g" runat="server" AllowPaging="tr ue"
PagerSettings-Visible="true">
<rowstyle HorizontalAlign ="Center"/>
<ItemTemplate >
<asp:Image ID="imgPhoto" runat="server" BorderWidth="0p x"
ImageAlign="Mid dle" ImageUrl='<%#
DataBinder.Eval (Container,"Dat aItem.filename" ,"images/photoalbum/{0}")
%>'/><br/>
<asp:Label ID="lblPhotoCap tion" runat="server"
AssociatedContr olID="imgPhoto" Text='<%#
DataBinder.Eval (Container,"Dat aItem.caption") %>'/><br/>
<asp:Label ID="lblPhotoDat e" runat="server"
AssociatedContr olID="imgPhoto" Text='<%#
DataBinder.Eval (Container,"Dat aItem.photodate ","Photo taken on: {0:D}")
%>'/>
</ItemTemplate>
</asp:FormView>
</form>
</body>
</html>
Partial Public Class FormViewTest : Inherits System.Web.UI.P age
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim photoalbum As New DataTable
Dim dataadapterSele ct As New
System.Data.Ole Db.OleDbDataAda pter("SELECT * FROM babyphotos ORDER BY
photodate,filen ame",
System.Configur ation.Configura tionManager.App Settings("conne ctionstring"))
dataadapterSele ct.Fill(photoal bum)
Me.fviewTesting .DataSource = photoalbum
Me.fviewTesting .DataBind()
End Sub
Private Sub fviewTesting_Pa geIndexChanged( ByVal sender As Object, ByVal
e As System.EventArg s) Handles fviewTesting.Pa geIndexChanged
Dim currfile As String = CType(Me.fviewT esting.DataItem ,
DataRowView)("f ilename").ToStr ing()
Dim photo As System.Drawing. Image =
System.Drawing. Image.FromFile( MapPath("images/photoalbum/" & currfile))
CType(Me.fviewT esting.FindCont rol("imgPhoto") , Image).Width =
photo.Width
CType(Me.fviewT esting.FindCont rol("imgPhoto") , Image).Height =
photo.Height
CType(Me.fviewT esting.FindCont rol("lblPhotoDa te"), Label).Text =
CDate(CType(Me. fviewTesting.Da taItem,
DataRowView)("p hotodate")).ToL ongDateString()
End Sub
End Class
What am I doing wrong? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/