Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,


1. I added dynamic controls using java script. Those controls disappears on post back.
I want the controls to be retained.

2. How to set auto postback property to html text box.

3. Next question is After post back the focus of the control is lost. It should also be retained.
Not specific control. It is a dynamic control.
For example: n text boxes with auto postback='true' are created in for loop. All the text box post backs. It should retain the dynamic controls, also focuses the exact control in which the user is typing

Kindly suggest me solutions for the above problems
Thanks
Posted

1 solution

Everytime a postback occurs thae whole page get recreated menas the server side controls that are in aspx or at codebehind will only be vailable. If you want to maintain the controls created using javascript then you can use one of two options like

- Use updatepanel and update the specific part of the page. Not the whole page.
- Other maintain the required information in hidden variable for the controls created via javascript and create those controls on every postback
 
Share this answer
 
Comments
R. Ganesh Kumar IT 30-Jul-13 5:34am    
Thanks for your reply. For Questions 2 and 3 what can I do?
Brij 30-Jul-13 5:45am    
autopostback is not a feature of html control. It is provided by asp.net server controls only. so either use asp.net controls or intiate an ajax call from html textbox.

For controls created via jaavscript, you need to maintain this info in some hidden variable and assign the focus once back else this should not be a problem of asp.net controls maintains the focus
R. Ganesh Kumar IT 30-Jul-13 5:47am    
thanks

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