EO.Web Pageview使用动态添加usercontrols

时间:2015-11-25 17:15:56

标签: asp.net vb.net

我正在使用必需对象的tabstrip和multipage控件。 我的目标是根据从数据库中检索的数据集动态构建tabstrip和综合浏览量。

到目前为止,动态构建工作正常,但我遇到了向每个网页浏览添加usercontrol的问题。

到目前为止,这是我的代码......

    Dim dt As New DataTable()
    Dim ds As New DataSet()
    Dim dr As DataRow
    Dim ts As New EO.Web.TabStrip
    Dim mp As New EO.Web.MultiPage
    ts = tsProgramMenu
    mp = mpProgramMenu

    dt = bc.getGrantProgram(strConnection, strGrantProgramId, strActive)

    For Each dr In dt.Rows
        'MULTI PAGE PAGEVIEWS
        Dim p As New EO.Web.PageView
        p.ID = "pv" & dr.Item(1).ToString

        mp.PageViews.Add(p)
        'TOP ROW TAB ITEMS
        Dim x As New EO.Web.TabItem
        x.Text.Html = dr.Item(1).ToString
        x.ItemID = "ti" & dr.Item(1).ToString
        x.PageViewID = p.ID
        ts.TopGroup.Items.Add(x)

    Next

在页面源代码中,我可以看到正在创建的综合浏览量。

<table id="ctl00_MainContent_pvHMGP" border="0" cellpadding="0" cellspacing="0" style="display:none;">
    <tr>
        <td valign="top"></td>
    </tr>
</table>

我在将usercontrol添加到网页浏览时遇到问题。 感谢您提供的任何帮助!!!

1 个答案:

答案 0 :(得分:0)

如果其他人有问题,这对我有用。

    Dim dt As New DataTable()
    Dim ds As New DataSet()
    Dim dr As DataRow
    Dim ts As New EO.Web.TabStrip
    Dim mp As New EO.Web.MultiPage
    ts = tsProgramMenu
    mp = mpProgramMenu

    dt = bc.getGrantProgram(strConnection, strGrantProgramId, strActive)

    For Each dr In dt.Rows
        'MULTI PAGE PAGEVIEWS
        Dim p As New EO.Web.PageView
        Dim uc As New UserControl
        Dim strUserControl As String

        strUserControl = dr.Item(1).ToString & ".ascx"
        uc.ID = "uc" & dr.Item(1).ToString
        p.ID = "pv" & dr.Item(1).ToString
        p.Controls.Add(Page.LoadControl(strUserControl))

        mp.PageViews.Add(p)
        'TOP ROW TAB ITEMS
        Dim x As New EO.Web.TabItem
        x.Text.Html = dr.Item(1).ToString
        x.ItemID = "ti" & dr.Item(1).ToString
        x.PageViewID = p.ID
        ts.TopGroup.Items.Add(x)

    Next