set default values in web.config?

8 posts, 1 answers
  1. mac
    mac avatar
    137 posts
    Member since:
    May 2008

    Posted 22 Jul 2008 Link to this post

    is it possible to set default values within the web.config file for specific controls?
    Perhaps the direction I am headed is incorrect, but I don't see another way to deal with this other than stepping very very deep into the skin files themselves, which I don't really want to do.
    for eg. It is possible to set the skin using
            <add key="Telerik.Skin" value="Vista" /> 

    but is is also possible the to default settings like AllowRowSelect for the R.A.D. grid?
     <add key="Telerik.Radgrid.ClientSettings.Selecting.AllowRowSelect" value="True"/>

    Wondering if I am perhaps going about this wrong. I tried using a standard .skin file in my theme folder, but kept getting Unknown server Tag 'telerik:RadGrid'.

    This was the skin I was attempting to use.
     <telerik:RadGrid Width="100%" SkinId="Postings"   runat="server"   
        GridLines="None"  BackColor="gold" AllowPaging="True">  
            <MasterTableView  AutoGenerateColumns="False">  
                  <PagerStyle Mode="NextPrevAndNumeric" /> 
                <RowIndicatorColumn Visible="False">  
                    <HeaderStyle Width="20px" /> 
                <ExpandCollapseColumn Resizable="False" Visible="False">  
                    <HeaderStyle Width="20px" /> 
                    <PopUpSettings ScrollBars="None" /> 
            <ClientSettings Selecting-AllowRowSelect="true">  
    thanks for your time and effort. the controls are really quite fantastic.
  2. Sean
    Sean  avatar
    54 posts
    Member since:
    Apr 2008

    Posted 22 Jul 2008 Link to this post

    I imagine that the reaon it cannot find the skin is because it is an embedded resource. If you were to take the source and recreate it locally in your project (why?) it could be done.

    I would say yes to your first part, though I have not tried it before writing this.
    What about putting the following on your ASPX page?

    Skin='<%# ConfigurationManager.AppSettings["Telerik.Skin"] %>'

    Logically it should work, though like I said.. I am a Spaghetti Coder and have no clue about what I speak, but I love to talk... a big dilemma  :D

    Sean Williams
    Electronic Arts, Orlando FL

  3. Martin de Ruiter
    Martin de Ruiter avatar
    99 posts
    Member since:
    Jun 2005

    Posted 22 Jul 2008 Link to this post

    An easy way to set default values is using the App_Themes directory. You can add a skin there to set properties of a control globally (note: not talking about the same kind of skin used in Telerik, it's a "theme skin", or theme, so you can add more themes if you like).

    In the web.config you can then decide which theme to use:
    <pages styleSheetTheme="MyDefaultTheme">

    In the theme itself you can set default properties for a control (so more then only a skin), for example:
    <telerik:RadEditor runat="server" EditModes="Design" Skin="WebBlue" Language="nl-NL" Width="690px" Height="300px" ToolsFile="~/toolsfile.xml" StripFormattingOnPaste="MSWordRemoveAll" />

    Very easy to skin your whole application with a single theme file.
  4. mac
    mac avatar
    137 posts
    Member since:
    May 2008

    Posted 22 Jul 2008 Link to this post

    Martin, have you been able to successfully use a .skin file and the telerik products? If you re-read my post, the issue appears to be that .net won't recognize the telerick:radgrid control in the .skin file
    What Sean says makes sense to a degree, but I think it would be a ton of effort.
    All I am trying to do is set defaults like allowClientRowSelect on all grids...

    I am assuming that theoretically I should be able to set the defaults in the web.config but just don't see the correct syntax


  5. Answer
    Vlad avatar
    11100 posts

    Posted 23 Jul 2008 Link to this post

    Hello mac,

    You need <%@ Register %> directive for Telerik.Web.UI in your skin file.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Komal
    Komal avatar
    4 posts
    Member since:
    Mar 2008

    Posted 24 Jul 2008 Link to this post

    I am also facing a similar problem.

    Even after adding the following line of code, at the top of the skin file, it is giving error.

    @ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

    The error message:
    Compiler Error Message: BC30002: Type 'Telerik.Web.UI.RadPanelBar' is not defined.

  7. mac
    mac avatar
    137 posts
    Member since:
    May 2008

    Posted 24 Jul 2008 Link to this post

    it worked right away for me. copied and pasted the @register directive from another aspx page using a grid or any telerik product and pasted it on line 1 of the skin file. no issues at all.
  8. Marty
    Marty avatar
    61 posts
    Member since:
    Oct 2008

    Posted 12 Dec 2008 Link to this post

    This worked perfectly for me to set all of my default atts on the telerik controls in my website.  Now I can change the look and feel of the whole page using the telerik skins and only  one word in the web.config.  Thanks!
Back to Top