We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add another text box programatically on a textchanged evnt of a text box in a place holder

Thread ID:




52497 Nov 29,2006 02:54 PM UTC ASP.NET Web Forms (Classic) 0
Tags: FAQ
Asked On November 29, 2006 02:54 PM UTC

Please give a solution for me for the following code. here i have a text box already after that when a text box value is changed and a new textbox will come in the place holder with postback property=true. After that when iam typing a value in that textbox (new one) and pressing the tab then the form will postback. but me want a new text box will generate there as the first text box textchanged event. how can me resolve the prob. Please help me

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb" Inherits="partyroute.test"%>


cellPadding="1" width="300" border="1">

Public Class test
Inherits System.Web.UI.Page

Dim k As Integer = 2

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
Private Sub InitializeComponent()

End Sub
Protected WithEvents a1 As System.Web.UI.WebControls.TextBox
Protected WithEvents ph As System.Web.UI.WebControls.PlaceHolder
Protected WithEvents lb As System.Web.UI.WebControls.Label

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then
ViewState("prd") = 1
lb.Text = ViewState("prd")
If ViewState("prd") > 1 Then
For k = 2 To ViewState("prd")
lb.Text = "hai"
End If
'lb.Text = ViewState("prd")
End If
End Sub

Sub addfds(ByVal s As String)
Dim txt As TextBox

txt = New TextBox
txt.ID = "a" & s
txt.AutoPostBack = True
'txt.Text = "a" & s
ph.Controls.Add(New LiteralControl("
End Sub

Private Sub a1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles a1.TextChanged
ViewState("prd") = ViewState("prd") + 1
End Sub
End Class


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon