Paging controls won't show up when using FormView

Discussion in 'ASP .Net' started by Nathan Sokalski, Jan 18, 2007.

  1. 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","images/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","Photo 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.AppSettings("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

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Jan 18, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Kennedy

    Why won't controls show up on my form

    Chris Kennedy, May 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    347
    Saravana [MVP]
    May 24, 2004
  2. Nathan Sokalski
    Replies:
    6
    Views:
    398
    Nathan Sokalski
    Jan 23, 2007
  3. Nathan Sokalski

    Why can't I get the FormView control's Paging controls to show?

    Nathan Sokalski, Jan 21, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    747
    Nathan Sokalski
    Jan 23, 2007
  4. Nathan Sokalski

    Paging controls won't show up when using FormView

    Nathan Sokalski, Jan 18, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    206
    Nathan Sokalski
    Jan 18, 2007
  5. Nathan Sokalski

    Why can't I get the FormView control's Paging controls to show?

    Nathan Sokalski, Jan 21, 2007, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    167
    Nathan Sokalski
    Jan 23, 2007
Loading...

Share This Page