Click here to Skip to main content
15,921,530 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a requirement to add a panel containing a user control (textbox) + 2 Gridviews with their own item templates + other validations operating on these controls, on a Web-Form dynamically resulting from a button click. So every time a user clicks a button "Add Panel", a new panel would be generated with the above controls.

I am trying the route of Data Lists and repeaters but binding the data to the above controls is becoming a challenge. I would like to investigate other frontiers to achieve this before going forward.

Any help, links, suggestions or pointers would be appreciated?

ZurdoDev 9-May-15 23:47pm    
That sounds complicated. You'll need to create the controls in the page's OnInit event. What else are you having trouble with?

1 solution

Share this answer
CodeforFood19 10-May-15 13:09pm    
I know how to create a control dynamically. But here the case is to generate the complete panel with these web controls dynamically. A repeater/datalist seems like a viable solution, but the issue comes when I try to bind the data to the row and the controls residing in it. Additionally I have noticed the individual validations working for these controls fire in conjunction. Ideally they should fire once for the row not affecting or triggering the validations in the other rows.

This is turning out to be more complicated than I thought. Still Stuck! More ideas please.
Maciej Los 10-May-15 13:13pm    
Nothing seems to be complicated. You didn't provide information where you get stuck and what code you use. How can i help you?
CodeforFood19 10-May-15 16:09pm    
Sorry Maciej Los, am working on a secured VPN environment; cant copy paste the code. TO create a dummy code snippet is an add on work. I was hoping some one would point out if I missed something obvious from a design consideration. Anyways, some how I have a reusable User Control implementation, which I can factor to meet my requirements. I am gonna take a shot at that.
Maciej Los 10-May-15 16:24pm    
You get me wrong. You should post only this piece of code which is related to your issue... We're not interested of rest of it.

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