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

Finding all telerik radcontrols in a form

6 Answers 241 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jai
Top achievements
Rank 1
Jai asked on 30 Nov 2011, 03:47 PM
Telerik Team,

I need to set the ForeColor of all the "Telerik RadControls" in my given form on a specific action. How do I loop through to find out all the Tlerik Controls Exists in my form. Let me know

Thanks

Jai

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 30 Nov 2011, 04:05 PM
Hi Jai,

You can find useful the following KB article: How-to create a javascript array of all particular RadControls on the page.

Greetings,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Jai
Top achievements
Rank 1
answered on 30 Nov 2011, 04:15 PM
Thanks for your quick response. Can you give me example/code for the Code Behind instead of Java Script.
0
Jai
Top achievements
Rank 1
answered on 30 Nov 2011, 06:17 PM
Telerik Team,

This is what I have in my Master Page. It's not setting the Forecolor to Gray. Need help.

<script type="text/javascript">
        function pageLoad() {
            var allRadControls = $telerik.radControls;
            alert(allRadControls.length);
            for (var i = 0; i < allRadControls.length; i++) {
                var element = allRadControls[i];
                element.style.Color = "Gray";
            }
        }
</script>

And In PageLoad Event (Code Behind) I am calling 
Page.RegisterStartupScript("JSFunc","pageLoad")

Thanks

Jai
0
Rumen
Telerik team
answered on 02 Dec 2011, 10:49 AM
Hi Jai,

Here is an example that will apply a red border to the RadEditor's wrapper element:

<telerik:RadEditor runat="server" ID="RadEditor1"
    StripFormattingOptions="NoneSupressCleanMessage"
    ContentFilters="None">
</telerik:RadEditor>
<script type="text/javascript">
    function pageLoad() {
        var allRadControls = $telerik.radControls;
        alert(allRadControls.length);
        for (var i = 0; i < allRadControls.length; i++) {
            var element = allRadControls[i];
            element.get_element().style.border = "1px solid red";
        }
    }
</script>

You should know that it is not possible to complete restyle the controls on the client. If you want to do that it is recommended to create your own custom skin or to modify the built-in skin.

Greetings,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
SupportFamas
Top achievements
Rank 2
answered on 21 Mar 2017, 09:13 AM
if i have to get all rad control in server side ,how to do that? 
0
Rumen
Telerik team
answered on 21 Mar 2017, 09:31 AM

Hello Ben,

You can find a solution in this forum http://www.telerik.com/forums/how-to-find-all-rad-controls-in-asp-net-page, i.e.

foreach (var control in form1.Controls) //Page.Controls
{
            if (control.GetType().Namespace == "Telerik.Web.UI")
            {
                //Your control is RAD control
            }
}

 

Regards,
Rumen
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussions
Asked by
Jai
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Jai
Top achievements
Rank 1
SupportFamas
Top achievements
Rank 2
Share this question
or