By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,223 Members | 1,403 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,223 IT Pros & Developers. It's quick & easy.

Paging controls won't show up when using FormView

P: n/a
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="FormViewTest.aspx.vb" Inherits="family.FormViewTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:FormView ID="fviewTesting" runat="server" AllowPaging="true"
PagerSettings-Visible="true">
<rowstyle HorizontalAlign="Center"/>
<ItemTemplate>
<asp:Image ID="imgPhoto" runat="server" BorderWidth="0px"
ImageAlign="Middle" ImageUrl='<%#
DataBinder.Eval(Container,"DataItem.filename","ima ges/photoalbum/{0}")
%>'/><br/>
<asp:Label ID="lblPhotoCaption" runat="server"
AssociatedControlID="imgPhoto" Text='<%#
DataBinder.Eval(Container,"DataItem.caption") %>'/><br/>
<asp:Label ID="lblPhotoDate" runat="server"
AssociatedControlID="imgPhoto" Text='<%#
DataBinder.Eval(Container,"DataItem.photodate","Ph oto taken on: {0:D}")
%>'/>
</ItemTemplate>
</asp:FormView>
</form>
</body>
</html>
Partial Public Class FormViewTest : Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim photoalbum As New DataTable
Dim dataadapterSelect As New
System.Data.OleDb.OleDbDataAdapter("SELECT * FROM babyphotos ORDER BY
photodate,filename",
System.Configuration.ConfigurationManager.AppSetti ngs("connectionstring"))
dataadapterSelect.Fill(photoalbum)
Me.fviewTesting.DataSource = photoalbum
Me.fviewTesting.DataBind()
End Sub

Private Sub fviewTesting_PageIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles fviewTesting.PageIndexChanged
Dim currfile As String = CType(Me.fviewTesting.DataItem,
DataRowView)("filename").ToString()
Dim photo As System.Drawing.Image =
System.Drawing.Image.FromFile(MapPath("images/photoalbum/" & currfile))
CType(Me.fviewTesting.FindControl("imgPhoto"), Image).Width =
photo.Width
CType(Me.fviewTesting.FindControl("imgPhoto"), Image).Height =
photo.Height
CType(Me.fviewTesting.FindControl("lblPhotoDate"), Label).Text =
CDate(CType(Me.fviewTesting.DataItem,
DataRowView)("photodate")).ToLongDateString()
End Sub
End Class
What am I doing wrong? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jan 18 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.