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

My simple Question is can we add controls (textbox, label, dropdown etc..) dynamically to ajax model popup extender.
if yes than please tell me how it is possible???

Thanks and Regards
Posted

1 solution

Hi,

Add a panel to your aspx page and give this panel id as PopupControlID to ModalPopupExtender

Add controls dynamically to this panel in your code behind

TextBox txtTest = new TextBox();
            txtTest.ID = "txtTest";
            yourpanelid.Controls.Add(txtTest);



Hope this helps....
 
Share this answer
 
Comments
nirbhaygiri 9-Dec-11 2:15am    
Thanks I did the same thing but its throwing me an error
"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."
sriman.ch 9-Dec-11 3:48am    
Have you wrote any javascript to find elements like document.getElementById('<%=control.ClientID%>');?
sriman.ch 9-Dec-11 3:50am    
http://leedumond.com/blog/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/

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