Click here to Skip to main content
14,866,582 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created one table in aspx page and for each click of a link button new rows will added to the table dynamically which containing 4 Textboxes. I want to get the TextChanged event for each text box but that event is not available in the intellisense for the Textboxes , Please help me to fire TextChanged event for the dynamically created textboxes.
Posted
Comments
[no name] 30-Jul-13 10:05am
   
"not available in the intellisense", then you have done something wrong and should show us your code.
prasy123 30-Jul-13 10:16am
   
"tblNewCan" is the table which I created in aspx page which already containing 2 rows so I set "hidInt.Value" as 3 to make textbox Id for 3rd row then the textbox Id will be txtPrice3.

Dim i As String = hidInt.Value.ToString()
Dim tr As New TableRow()
Dim td1 As New TableCell()
Dim txtPrice As New TextBox
txtPrice .ID = "txtPrice" + i
td1.Controls.Add(txtPrice)
tr.Cells.Add(td1)
tblNewCan.Rows.Add(tr)

1 solution

You can get the solution here - [RESOLVED] add event to dynamically created textbox[^].
Comments
prasy123 30-Jul-13 12:20pm
   
Your solution helped me to add TextChanged event to the dynamically created textbox but that event is not firing , I set Autopostback=true for that textbox please share with me know if you have any idea on this.
   
Is your problem solved? I mean, is it firing? Or you still have problems?
prasy123 30-Jul-13 12:30pm
   
No, TextChanged event is not firing.
   
Try creating the TextBox in Page_Init method...
prasy123 30-Jul-13 12:52pm
   
I have to add new row into a table with that TextBox in a link button click event so not able to create that in page_Init method.
   
Have you set the runat = server attribute of TextBox?
prasy123 30-Jul-13 13:28pm
   
No I didn't let me try that...
Also the dynamically added rows are disappearing after AutoPostback of Textbox do you any way to prevent that too..

Thanks for the quick responses.
   
Please try with runat = server, else the TextBox can't be asp controls....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900