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

Decorate dynamic controls at client - side.

5 Answers 62 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Abhijit Shetty
Top achievements
Rank 2
Abhijit Shetty asked on 10 Oct 2012, 07:08 PM
Hi,

I have a scenario where I'm dynamically creating checkbox at client side and need to decorate it using RadFormDecorator.
For Ex:
<form id="form1" runat="server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
           <Scripts>
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
               <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
           </Scripts>
       </asp:ScriptManager>
       <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Default" DecoratedControls="All" />
       <div id="d"></div>
   </form>
   <script type="text/javascript">
       window.onload = function () {
           var cb = document.createElement('input');
           cb.type = 'checkbox';
           document.getElementById('d').appendChild(cb);
           var decorator = $find("<%= RadFormDecorator1.ClientID %>");
           if (decorator) {
               decorator.decorate(cb, true);
           }
       }
   </script>
Thanks in advance...

5 Answers, 1 is accepted

Sort by
0
Abhijit Shetty
Top achievements
Rank 2
answered on 11 Oct 2012, 04:40 AM
I found out after debugging javascript that instead of passing control to decorate as parameter, we need to pass its container control as parameter.
In short:Code will be (higlighted in bold)
<script type="text/javascript">
       window.onload = function () {
           var cb = document.createElement('input');
           cb.type = 'checkbox';
           document.getElementById('d').appendChild(cb);
           var decorator = $find("<%= RadFormDecorator1.ClientID %>");
           if (decorator) {
               decorator.decorate(cb.parentNode, true);
                    // OR decorator.decorateInput(cb);
           }
       }
   </script>
0
Accepted
Niko
Telerik team
answered on 15 Oct 2012, 03:20 PM
Hello,

Your observations are quite correct. The decorate method expects as input the container that holds the different controls to be decorated. Please, keep in mind that there can be different kinds of decorated controls, therefore we need just the container.
 If you need to decorate just the checkbox you can use decorateInput and simply send the input to be decorated. Still you should keep in mind that if you choose this approach the checkbox will be decorated unconditionally, i.e. if it has a className it will still be decorated.

Hope this helps.

Kind regards,
Niko
the Telerik team
Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
0
Abhijit Shetty
Top achievements
Rank 2
answered on 16 Oct 2012, 06:01 AM
Thanks Niko,
I have a doubt about response time from telerik group for posts. How soon can i expect reply from you after adding a post. I dont see any response for 3-4 days because of which productivity time gets affected.
I'm planning to buy product only after testing it on trial but finding it difficult to implement and draw a conclusion because of delay in response.

Thanks.
0
Rumen
Telerik team
answered on 16 Oct 2012, 10:17 AM
Hi,

The forums are considered a community resource and although we closely monitor them, we cannot guarantee a timely response there. That is why in such cases we strongly recommend to use the support ticketing system in your Client.net account.

Best regards,
Rumen
the Telerik team
Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
0
Abhijit Shetty
Top achievements
Rank 2
answered on 16 Oct 2012, 10:26 AM
Thanks Rumen. I din't knew that!!!
Tags
FormDecorator
Asked by
Abhijit Shetty
Top achievements
Rank 2
Answers by
Abhijit Shetty
Top achievements
Rank 2
Niko
Telerik team
Rumen
Telerik team
Share this question
or