Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
For example..

I want when I insert mybe a number "2" on a textbox to view two more textboxesmore immediately , when I insert 4 on a textbox to view another 4 textboxes..

Thanks in advance.....
Posted
Updated 29-Jul-15 12:24pm
v2

1 solution

You should hook to TextChanged event of TextBox, that fires as soon as some text is entered in the text box.

In the handler you can put your functionality of adding more text boxes.

https://msdn.microsoft.com/en-us/library/system.windows.forms.control.textchanged[^]
 
Share this answer
 
Comments
[no name] 30-Jul-15 0:09am    
I don't see how that will help on a web page.... are you sure this will work?
himanshu agarwal 30-Jul-15 1:17am    
Well you did not mention "web" in your question, but, apparantly if you are using ASP .NET controls you'd be setting the runat property to server (runat="server"). This ensures that any value change in the textbox will cause a postback and will also hit your TextChanged event where you can add the behavior you require.

https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.textchanged(v=vs.110).aspx
Siyabonga Nkosi 30-Jul-15 4:26am    
i forgot to mention i wanna do this on mvc...

Wes Aday.. yes i think it is possible because on web forms you can do it now i wanna implement it on mvc
himanshu agarwal 30-Jul-15 4:30am    
MVC is just a design pattern, it only changes the abstraction level, but the essence should be the same.

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