asked on
' This is the textchanged event handler for the dynamically created text box and when I change the text and then move off the text box it doesn't execute.
Protected Sub txtTest_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtTest.TextChanged
Dim s As String = txtTest.Text
Me.ViewState.Add("strTest", s)
End Sub
' This is what runs when the button to confirm time period selection is clicked, all works fine and the data is displayed as intended.
For i As Integer = 0 To tDirectors.Rows.Count - 1
Dim row_data As New TableRow()
'row_data.ID = tDirectors.Rows(i)("DirectorID").ToString
'Dim cell_director_id As New TableCell
'cell_director_id.Text = tDirectors.Rows(i)("DirectorID")
'row_data.Cells.Add(cell_director_id)
Dim cell_name As New TableCell
cell_name.ID = "DirectorID:" + tDirectors.Rows(i)("DirectorID").ToString
cell_name.Text = tDirectors.Rows(i)("Director")
row_data.Cells.Add(cell_name)
For int As Integer = 0 To tMonths.Rows.Count
If int < tMonths.Rows.Count Then
dvRevenues.RowFilter =
"(DirectorID = " & tDirectors.Rows(i)("DirectorID") & ") and (MonthID = " & tMonths.Rows(int)("id").ToString & ") or " &
"(DirectorID = 0) and (MonthID = " & tMonths.Rows(int)("id").ToString & ")"
For Each row As DataRowView In dvRevenues
'cells to show revenues and when applicable a text box for editing the revenue amount
Dim cell_revenue As New TableCell
'cell_revenue.ID = row("DirectorID").ToString & " " & row("MonthID").ToString
If tMonths.Rows(int)("id") = row("MonthID") Then
If Not row("Closed") Then
Dim txtEditRevenue As New TextBox()
'txtEditRevenue.AutoPostBack = True
If row("DirectorID") <> 0 Then
txtEditRevenue.ID = "DirectorID:" + row("DirectorID").ToString & "MonthID:" & row("MonthID").ToString
txtEditRevenue.Text = row("Revenue").ToString
Dim dtRow As DataRow = dt.NewRow()
dtRow("MonthID") = row("MonthID")
dtRow("DirectorID") = row("DirectorID")
dtRow("Revenue") = row("Revenue")
dt.Rows.Add(dtRow)
ElseIf row("DirectorID") = 0 Then
txtEditRevenue.ID = cell_name.ID + "MonthID:" + row("MonthID").ToString
End If
txtEditRevenue.Width = 50
cell_revenue.Controls.Add(txtEditRevenue)
AddHandler txtEditRevenue.TextChanged, AddressOf txtEditRevenueTextChanged
ElseIf row("Closed") Then
cell_revenue.Text = row("Revenue").ToString
End If
End If
row_data.Cells.Add(cell_revenue)
Next
Next
Next