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

set default values in web.config?

7 Answers 489 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mac
Top achievements
Rank 1
mac asked on 22 Jul 2008, 05:00 PM
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
<appSettings> 
        <add key="Telerik.Skin" value="Vista" /> 
     </appSettings> 

but is is also possible the to default settings like AllowRowSelect for the R.A.D. grid?
ie
 <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" /> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn Resizable="False" Visible="False">  
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
            <EditFormSettings> 
                <PopUpSettings ScrollBars="None" /> 
            </EditFormSettings> 
            
        </MasterTableView> 
        <ClientSettings Selecting-AllowRowSelect="true">  
        </ClientSettings> 
        
    </telerik:RadGrid> 
thanks for your time and effort. the controls are really quite fantastic.
mac

7 Answers, 1 is accepted

Sort by
0
Sean
Top achievements
Rank 2
answered on 22 Jul 2008, 10:33 PM
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

0
Martin de Ruiter
Top achievements
Rank 2
answered on 22 Jul 2008, 10:56 PM
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.
0
mac
Top achievements
Rank 1
answered on 23 Jul 2008, 04:59 AM
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

mac

0
Accepted
Vlad
Telerik team
answered on 23 Jul 2008, 05:02 AM
Hello mac,

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

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Komal
Top achievements
Rank 1
answered on 24 Jul 2008, 02:11 PM

Hi,
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.

0
mac
Top achievements
Rank 1
answered on 24 Jul 2008, 05:59 PM
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.
mac
0
Marty
Top achievements
Rank 1
answered on 12 Dec 2008, 02:24 PM
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!
Tags
General Discussions
Asked by
mac
Top achievements
Rank 1
Answers by
Sean
Top achievements
Rank 2
Martin de Ruiter
Top achievements
Rank 2
mac
Top achievements
Rank 1
Vlad
Telerik team
Komal
Top achievements
Rank 1
Marty
Top achievements
Rank 1
Share this question
or