FormView - Paging

Discussion in 'ASP .Net' started by DesCF, Aug 9, 2007.

  1. DesCF

    DesCF Guest

    I have programatically created a DataSet (mdsShippers) that consists of a
    single DataTable - the Shippers table from Northwind. I have then added a
    FormView control to my WebForm and then two text-boxes in the ItemTemplate
    (txShipperID and txtCompanyName). In order to get the FormView to display
    and page through the records properly I have written the sode shown
    below. However, I have arrived at it through experimentation without
    really knowing what I am doing. My question is, am I doing what I am
    doing right ?


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Load

    If Not Page.IsPostBack Then
    bdl_LoadShips() ' Creates DataSet and populates DataTable
    Else
    Me.mdsShippers = Session("Shippers")
    End If

    With Me.fvShippers
    .DataSource = Me.mdsShippers.Tables("dtShippersLIST")
    .DataBind()
    End With

    End Sub

    Protected Sub fvShippers_PageIndexChanging(ByVal sender As Object, ByVal
    e As System.Web.UI.WebControls.FormViewPageEventArgs) Handles
    fvShippers.PageIndexChanging

    Me.fvShippers.PageIndex = e.NewPageIndex
    Me.fvShippers.DataBind()

    End Sub

    Protected Sub Page_Unload(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Unload

    Session("Shippers") = Me.mdsShippers

    End Sub


    --








    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
    DesCF, Aug 9, 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. ThePurpleCat
    Replies:
    0
    Views:
    846
    ThePurpleCat
    Oct 18, 2006
  2. Nathan Sokalski
    Replies:
    0
    Views:
    496
    Nathan Sokalski
    Jan 18, 2007
  3. Nathan Sokalski
    Replies:
    6
    Views:
    389
    Nathan Sokalski
    Jan 23, 2007
  4. Chris

    Formview within Formview

    Chris, May 19, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    507
    Chris
    May 19, 2007
  5. David Thielen

    FormView/Repeater/ Eval(FormView data)

    David Thielen, Jun 16, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    624
    David Thielen
    Jun 16, 2006
Loading...

Share This Page