Loop Telerik controls

3 posts, 1 answers
  1. Mark
    Mark avatar
    132 posts
    Member since:
    Feb 2008

    Posted 15 Nov 2008 Link to this post

    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. Answer
    Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 15 Nov 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark
    Mark avatar
    132 posts
    Member since:
    Feb 2008

    Posted 16 Nov 2008 Link to this post

    Great, that will help me.

    Many Thanks
Back to Top