This is a migrated thread and some comments may be shown as answers.

Create Controls Dynamically

1 Answer 189 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Juergen Puscher
Top achievements
Rank 1
Juergen Puscher asked on 05 Aug 2009, 08:59 AM
Hi all,

i stick a little bit with realizing a common usecase. I hope someone can give me a short instruction about what to do.
We need to create Controls dynamically using AJAX / without full page submits.

A simple example would be the following:
We have a regular ASP-Button inside an other control. When someone click the button there should start an AjaxRequest to the CodeBehind Class. The method in the CodeBehind Class should generate a new RadComboBox with data from an XML-File and place the RadComboBox in the parent Control. Of course, when the AJAX Request finished the RadComboBox should be displayed in the Client, but without rerendering the hole RadPane. Using a PlaceHolder is also no Option because i dont know how much Controls i need. And placeing all of them in the same PlaceHolder which is connected by RadAjaxManager means that all new Controls in the PlaceHolder will be rerendered when i update the PlaceHolder. Also the dynamic created Controls are NOT persistent. Its hard to realize that. That means I've to recreate them on each PageLoad / Partial Load of the Parent.

Isn't it possbile to create a Control, which is persistent like if I have create it declarativly?


Building a RadComboBox and fill it with XML is also no problem.
I cant define the Controls declaratively and just  hide/show them, because we dont know which kind of control the user will choose.
Using the RadAjaxManager also doesnt work in my tests because wasn't able to tell him the ID of the TargetControlID to rerender (because it soes not exist at the moment). Rerender the surrounding Control was also not as good as we expected, because it contains much other controls which should not rerender.....

Does someone have a suggestion for me ?

Thank you

ragards

Alex

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 10 Aug 2009, 09:51 AM
Hello Juergen,

The RadControls for ASP.NET AJAX are IScript controls and there is no difference in dynamic creating MS ASP.NET script controls and RadControls. I will suggest you examine this online blog post devoted on the same matter.

Best wishes,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Juergen Puscher
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or