Saving Dynamic Web User Control vb.net

63 views Asked by At

I have a tab container with dynamic tab panel, each tab panel has dynamic web user control. This web user control contains dynamic grid view which has drop down list and text box columns where user has to input data. Since my tab panel is dynamically created during page_init, the data that user inputted loses on saving.

Here's how I add my tab container:

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   

What is going wrong? Thanks for your help.

0

There are 0 answers