IE Webcontrols Multipage/Pageview and the Datagrid

Discussion in 'ASP .Net Web Controls' started by Ric Houser, Nov 5, 2003.

  1. Ric Houser

    Ric Houser Guest

    Hello All,

    Simple question: Is it possible to display a datagrid in
    a multipage:pageview? It seems that all asp controls
    (asp:checkbox, asp:listbox...) will work fine on a
    pageview. However the asp:datagrid or asp:repeater
    controls don't seem to work. Any help would be greatly
    appricated.

    Ric
    Ric Houser, Nov 5, 2003
    #1
    1. Advertising

  2. Hi Ric,

    I tried the following code on my side and it worked fine. In my code, I
    dynamically added to pageviews to the MultiPage web control, and on the
    first pageview, I added a TextBox and on the second pageview, I added a
    DataGrid.

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here

    Dim pv As PageView = New PageView
    MultiPage1.Controls.Add(pv)

    Dim txt As TextBox = New TextBox
    txt.ID = "text1"
    txt.Text = "Miranda"

    pv.Controls.Add(txt)

    Dim DataGrid1 As DataGrid = New DataGrid
    DataGrid1.DataSource = CreateDataSource()
    DataGrid1.DataBind()

    Dim pv2 As PageView = New PageView
    MultiPage1.Controls.Add(pv2)

    pv2.Controls.Add(DataGrid1)

    MultiPage1.SelectedIndex = 1

    End Sub

    Function CreateDataSource() As ICollection
    Dim dt As New DataTable
    Dim dr As DataRow

    dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
    dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
    dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))

    Dim i As Integer
    For i = 0 To 8
    dr = dt.NewRow()

    dr(0) = i
    dr(1) = "Item " + i.ToString()
    dr(2) = 1.23 * (i + 1)

    dt.Rows.Add(dr)
    Next i

    Dim dv As New DataView(dt)
    Return dv
    End Function 'CreateDataSource

    If I have misunderstood you concern, please feel free to let me know.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    Get Secure! ¨C www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jacob Yang [MSFT], Nov 6, 2003
    #2
    1. Advertising

  3. Ric Houser

    Guest Guest

    Thanks Jacob

    Don't know what I was leaving out before, but everything
    seems to work fine now.

    Thanks
    Ric
    >-----Original Message-----
    >Hi Ric,
    >
    >I tried the following code on my side and it worked

    fine. In my code, I
    >dynamically added to pageviews to the MultiPage web

    control, and on the
    >first pageview, I added a TextBox and on the second

    pageview, I added a
    >DataGrid.
    >
    >Private Sub Page_Load(ByVal sender As System.Object,

    ByVal e As
    >System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    >
    > Dim pv As PageView = New PageView
    > MultiPage1.Controls.Add(pv)
    >
    > Dim txt As TextBox = New TextBox
    > txt.ID = "text1"
    > txt.Text = "Miranda"
    >
    > pv.Controls.Add(txt)
    >
    > Dim DataGrid1 As DataGrid = New DataGrid
    > DataGrid1.DataSource = CreateDataSource()
    > DataGrid1.DataBind()
    >
    > Dim pv2 As PageView = New PageView
    > MultiPage1.Controls.Add(pv2)
    >
    > pv2.Controls.Add(DataGrid1)
    >
    > MultiPage1.SelectedIndex = 1
    >
    > End Sub
    >
    >Function CreateDataSource() As ICollection
    > Dim dt As New DataTable
    > Dim dr As DataRow
    >
    > dt.Columns.Add(New DataColumn("IntegerValue",

    GetType(Int32)))
    > dt.Columns.Add(New DataColumn("StringValue",

    GetType(String)))
    > dt.Columns.Add(New DataColumn("CurrencyValue",

    GetType(Double)))
    >
    > Dim i As Integer
    > For i = 0 To 8
    > dr = dt.NewRow()
    >
    > dr(0) = i
    > dr(1) = "Item " + i.ToString()
    > dr(2) = 1.23 * (i + 1)
    >
    > dt.Rows.Add(dr)
    > Next i
    >
    > Dim dv As New DataView(dt)
    > Return dv
    > End Function 'CreateDataSource
    >
    >If I have misunderstood you concern, please feel free to

    let me know.
    >
    >Best regards,
    >
    >Jacob Yang
    >Microsoft Online Partner Support
    >Get Secure! ¨C www.microsoft.com/security
    >This posting is provided "as is" with no warranties and

    confers no rights.
    >
    >.
    >
    Guest, Nov 7, 2003
    #3
    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. szabelin
    Replies:
    1
    Views:
    1,573
    Teemu Keiski
    Aug 20, 2003
  2. RedEagle
    Replies:
    0
    Views:
    464
    RedEagle
    Aug 20, 2004
  3. gce
    Replies:
    0
    Views:
    415
  4. mawi

    Persist multipage pageview contents?

    mawi, Jul 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    123
  5. Dickson

    add control to multipage pageview???

    Dickson, Sep 28, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    124
    Dickson
    Sep 28, 2004
Loading...

Share This Page