Try to remove the If Not Postback check from the page load event:
MultiView1.SetActiveView(View1)
Dim PageNam As String = Request.QueryString("PageName")
PageId.Value = PageNam
Dim ds As DataSet = GetInspired.GetPageContent(PageNam)
' Dim ds As DataSet = GetInspired.GetPageContent("Default")
Dim MeCount As Integer = ds.Tables(0).Rows.Count()
Response.Write(MeCount)
For i = 0 To MeCount - 1
Dim myLabel = New Label
myLabel.ID = "lbl" & i + 1
myLabel.Text = "Content For " & ds.Tables(0).Rows(i).Item(2)
myLabel.CssClass = "lbl_sec"
Dim myTextBox = New TextBox
myTextBox.ID = ds.Tables(0).Rows(i).Item(0)
Dim LastTextBoxId As String = myTextBox.ID
myTextBox.CssClass = "Text_Sec"
myTextBox.TextMode = TextBoxMode.MultiLine
PageContentSection.Controls.Add(HtmlHelper.GetLiteral("<div id=Txt-" & LastTextBoxId & " >"))
Me.PageContentSection.Controls.Add(myLabel)
Me.PageContentSection.Controls.Add(myTextBox)
myTextBox.Text = ds.Tables(0).Rows(i).Item(3)
PageContentSection.Controls.Add(HtmlHelper.GetLiteral("</div>"))
Next
End Sub
mm10
Contributor
6439 Points
1184 Posts
Re: how to get value from dynamic created text box
Apr 04, 2012 04:05 PM|LINK
Try to remove the If Not Postback check from the page load event:
MultiView1.SetActiveView(View1) Dim PageNam As String = Request.QueryString("PageName") PageId.Value = PageNam Dim ds As DataSet = GetInspired.GetPageContent(PageNam) ' Dim ds As DataSet = GetInspired.GetPageContent("Default") Dim MeCount As Integer = ds.Tables(0).Rows.Count() Response.Write(MeCount) For i = 0 To MeCount - 1 Dim myLabel = New Label myLabel.ID = "lbl" & i + 1 myLabel.Text = "Content For " & ds.Tables(0).Rows(i).Item(2) myLabel.CssClass = "lbl_sec" Dim myTextBox = New TextBox myTextBox.ID = ds.Tables(0).Rows(i).Item(0) Dim LastTextBoxId As String = myTextBox.ID myTextBox.CssClass = "Text_Sec" myTextBox.TextMode = TextBoxMode.MultiLine PageContentSection.Controls.Add(HtmlHelper.GetLiteral("<div id=Txt-" & LastTextBoxId & " >")) Me.PageContentSection.Controls.Add(myLabel) Me.PageContentSection.Controls.Add(myTextBox) myTextBox.Text = ds.Tables(0).Rows(i).Item(3) PageContentSection.Controls.Add(HtmlHelper.GetLiteral("</div>")) Next End Sub