1

AjaxTabContainer の TabPanel 内にある gridview に動的に追加されたテキスト ボックスから値を読み取るのが難しい状況に直面しています。

すべてのコントロールは、ユーザー オプションに従って動的に追加されることに注意してください。

シーケンスは次のようになります。

  
Design Time:
One Panel and other user options (date & some other fields)

Run Time:
- Add AjaxTab container & Tab Panel which is vary upon user filter (Tab created based on db -records)
- Inside each tab, added the GridView with dataset
- Add some textbox into each of GridView Line

ページ上: テキスト ボックス付きのグリッドビューでタブ コントロールを正常に表示できます (*下記参照)ダイナミック テキスト ボックス では、ユーザーが [更新] ボタンをクリックしたときに各テキスト ボックス内の値を読み取る方法を教えてください。FindControls を使用しようとしましたが、何もありません。

私のコード:-


Private Sub DynamicTabGVLoad(ByVal seqno As String)
        createTab()
        ds = allotmentdb.getRoomType()
        For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            Dim tabcontent As New Control()
            Dim tbldynamic As New Table()
            Dim tbrdynamic As New TableRow()
            Dim tbcdynamic As New TableCell()           
            Dim roomtypekey As String
            roomtypekey = ds.Tables(0).Rows(i)("roomtypekey").ToString()
            Dim gv_alines As New GridView
            gv_alines.AutoGenerateColumns = True
            gv_alines.Attributes.Add("runat", "server")
            Dim ds1 As New Data.DataSet()
            ds1 = allotmentdb.getAllotmentLinesTabGV(roomtypekey, seqno, System.DateTime.Now.ToString(("yyyy-MM-dd")))
            gv_alines.EmptyDataText = "No Record Found!"
            'gv_alines.ShowHeaderWhenEmpty = True
            gv_alines.DataSource = ds1
            gv_alines.DataBind()
            If gv_alines.Rows.Count > 0 Then
                gv_alines.HeaderRow.Cells(0).Visible = False
                gv_alines.HeaderRow.Cells(1).Visible = False
                gv_alines.HeaderRow.Cells(4).Visible = False
                For Each gvr As GridViewRow In gv_alines.Rows
                    gvr.Cells(0).Visible = False
                    gvr.Cells(1).Visible = False
                    gvr.Cells(4).Visible = False
                    Dim txtInternetRoom As New TextBox()
                    txtInternetRoom.ID = "txtInternetRoom"
                    txtInternetRoom.Text = gvr.Cells(5).Text
                    txtInternetRoom.Style.Add("text-align", "right")
                    txtInternetRoom.Width = 100
                    gvr.Cells(5).Controls.Add(txtInternetRoom)
                    Dim txtInternetRate As New TextBox()
                    txtInternetRate.ID = "txtInternetRate"
                    txtInternetRate.Text = FormatNumber(gvr.Cells(6).Text, 2)
                    If txtInternetRate.Text = "0.00" Then txtInternetRate.Text = "NA"
                    txtInternetRate.Style.Add("text-align", "right")
                    txtInternetRate.Width = 100
                    gvr.Cells(6).Controls.Add(txtInternetRate)
                    Dim txtInternetRate2 As New TextBox()
                    txtInternetRate2.ID = "txtInternetRate2"
                    txtInternetRate2.Text = FormatNumber(gvr.Cells(7).Text)
                    If txtInternetRate2.Text = "0.00" Then txtInternetRate2.Text = "NA"
                    txtInternetRate2.Style.Add("text-align", "right")
                    txtInternetRate2.Width = 100
                    gvr.Cells(7).Controls.Add(txtInternetRate2)
                    Dim txtInternetRate3 As New TextBox()
                    txtInternetRate3.ID = "txtInternetRate3"
                    txtInternetRate3.Text = FormatNumber(gvr.Cells(8).Text)
                    If txtInternetRate3.Text = "0.00" Then txtInternetRate3.Text = "NA"
                    txtInternetRate3.Style.Add("text-align", "right")
                    txtInternetRate3.Width = 100
                    gvr.Cells(8).Controls.Add(txtInternetRate3)
                    Dim txtInternetRate4 As New TextBox()
                    txtInternetRate4.ID = "txtInternetRate4"
                    txtInternetRate4.Text = FormatNumber(gvr.Cells(9).Text)
                    If txtInternetRate4.Text = "0.00" Then txtInternetRate4.Text = "NA"
                    txtInternetRate4.Style.Add("text-align", "right")
                    txtInternetRate4.Width = 100
                    gvr.Cells(9).Controls.Add(txtInternetRate4)
                Next
            Else               
            End If
            tbcdynamic.Controls.Add(gv_alines)
            tbrdynamic.Cells.Add(tbcdynamic)
            tbldynamic.Rows.Add(tbrdynamic)
            tabcontent.Controls.Add(tbldynamic)
            ajxTab.Tabs(i).Controls.Add(tabcontent)
        Next
        pnlDynamic.Controls.Add(ajxTab)
    End Sub
    Private Sub createTab()
        ds = allotmentdb.getRoomType()
        ajxTab = New AjaxControlToolkit.TabContainer()
        ajxTab.Attributes.Add("runat", "server")
        'Me.Controls.Add(ajxTab)
        For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            Dim tbpnlDynamic As New TabPanel()
            tbpnlDynamic.Attributes.Add("runat", "server")
            tbpnlDynamic.HeaderText = ds.Tables(0).Rows(i)("RoomType").ToString()
            tbpnlDynamic.ID = ds.Tables(0).Rows(i)("RoomTypeKey").ToString()
            tbpnlDynamic.Visible = True
            ajxTab.Tabs.Add(tbpnlDynamic)
            ajxTab.ActiveTabIndex = 0
        Next
    End Sub

緊急に必要です。前もって感謝します!

4

0 に答える 0