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

Loop Telerik controls

2 Answers 135 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 15 Nov 2008, 05:16 PM
Hi,

I have many Telerik controls within many many pages.
 Each of my users would like to use different skins.

Can i loop through all Telerik controls on a page (server-side as i retrieve user skin from database), or....
Do i have to set the skin property server-side for each telerik control ???

If so , how ?

Many Thanks
Mark

2 Answers, 1 is accepted

Sort by
0
Accepted
Kevin Babcock
Top achievements
Rank 1
answered on 16 Nov 2008, 05:01 AM
Hi Mark,

With the recent release of the Q3 2008 version of the RadControls for ASP.NET AJAX we released a new control, the RadSkinManager. You can use this control to apply a skin to all controls on the page. If you want to retrieve a user's skin preference from a data store and apply it programmatically, you can easily do that. Here is an example:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Telerik.Examples._Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Example - Setting a Skin Programmatically Using the RadSkinManager</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:RadSkinManager ID="RadSkinManager1" runat="server" /> 
         
        <telerik:RadCalendar ID="RadCalendar1" runat="server"  
            Height="250px"  
            Width="400px">           
        </telerik:RadCalendar> 
 
        <telerik:RadComboBox ID="RadComboBox1" runat="server"  
            DataSourceID="SqlDataSource1"  
            DataTextField="CompanyName"  
            DataValueField="CustomerID"
        </telerik:RadComboBox> 
 
        <telerik:RadGrid ID="RadGrid1" runat="server"  
            AllowPaging="True"  
            AllowSorting="True" 
            AutoGenerateColumns="true" 
            DataSourceID="SqlDataSource1"  
            GridLines="None"
        </telerik:RadGrid> 
         
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"            
            SelectCommand="SELECT [CustomerID], [CompanyName], [Address], [City], [Region], [PostalCode], [Country] FROM [Customers]"
        </asp:SqlDataSource> 
         
    </form> 
</body> 
</html> 
 

using System; 
 
namespace Telerik.Examples 
    public partial class _Default : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            RadSkinManager1.Skin = "Telerik"
        } 
    } 
 

You can also set the RadSkinManager.ShowChooser property to 'true' and a combo box containing all skin choices will render to the page, allowing the user to change the skin on the fly.

I hope this helps. Let me know if you have any further questions.

Regards,
Kevin Babcock
0
Mark
Top achievements
Rank 1
answered on 16 Nov 2008, 09:35 AM
Great, that will help me.

Many Thanks
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Share this question
or