保存动态Web用户控件vb.net

时间:2018-12-19 05:27:45

标签: asp.net vb.net webusercontrol

我有一个带有动态标签面板的标签容器,每个标签面板都有动态的Web用户控件。该Web用户控件包含动态网格视图,该视图具有下拉列表和文本框列,用户必须在其中输入数据。由于我的标签面板是在page_init期间动态创建的,因此用户输入的数据会在保存时丢失。

这是我添加标签容器的方式:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    Dim conQ As SqlConnection
    Dim cmdQ As String = ConfigurationManager.ConnectionStrings("DBConn").ConnectionString

    conQ = New SqlConnection(cmdQ)
    Dim sqlCmdQ As New SqlCommand("dbo.spGetStatus", conQ)
    sqlCmdQ.CommandType = Data.CommandType.StoredProcedure
    sqlCmdQ.Parameters.Add(New SqlParameter("@tCode", SqlDbType.NVarChar))
    sqlCmdQ.Parameters("@tCode").Value = "SlsParameter"

    conQ.Open()

    Dim daQ As SqlDataAdapter = New SqlDataAdapter(sqlCmdQ)
    Dim tableP As DataTable = New DataTable
    daQ.Fill(tableP)
    Dim i As Integer = 0
    For Each PanelRow As DataRow In tableP.Rows
        Dim tbParameter As New AjaxControlToolkit.TabPanel()
        tbParameter.ID = "tab" + tableP.Rows(i).Item(0).ToString
        tbParameter.HeaderText = tableP.Rows(i).Item(1).ToString
        Dim HeaderTitle As String
        HeaderTitle = PanelRow("tIdentity").ToString()
        Dim a As New ParameterWebUserControl
        a = Page.LoadControl("~/ParameterWebUserControl.ascx")
        a.ID = "ParameterWebUserControl"
        a.refGroup = HeaderTitle
        tbParameter.Controls.Add(a)
        tbcParameter.Controls.Add(tbParameter)
        i = i + 1
    Next
    tbcParameter.Tabs(0).Visible = False
End Sub   

出了什么问题?感谢您的帮助。

0 个答案:

没有答案