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

getting skin of parent container

3 Answers 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Growls
Top achievements
Rank 1
Growls asked on 09 Dec 2009, 11:08 PM
is there a way to assign the skin to templated controls based on the parent controls skin? or is there an eay way to assign the skin based on formdecorator?

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Dec 2009, 02:54 PM
Hi Craig,

Yes, both are possible, have you tried? You have to obtain a reference to the parent control (or RadFormDecorator) and get their Skin property value. If you don't want to hard-code some control IDs when obtaining a reference, another approach is to iterate through the Controls collection of the page and search for controls which implement the ISkinnableControl interface. They all have a Skin property. However, the first approach is simpler, as you may need to iterate recursively and this is not best for the performance.


Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Growls
Top achievements
Rank 1
answered on 10 Dec 2009, 09:47 PM
I meant from the markup. eg:
<telerik:RadUpload ID="RadUpload1" runat="server" FocusOnLoad="True" MaxFileInputsCount="3"  
ToolTip="Select Image to upload" Skin="<%# (FormDecorator1.Skin) %>"
                                </telerik:RadUpload> 

is something like this acheivable from a templated control? the above doesnt work
0
Dimo
Telerik team
answered on 11 Dec 2009, 09:49 AM
Hi Craig,

Binding expressions work only if the control is databound. If the control does not do that automatically, you should do it manually.

<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<script runat="server">
 
    protected void Page_Load(object sender, EventArgs e)
    {
        RadUpload1.DataBind();
    }
     
</script>
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls for ASP.NET AJAX</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Forest" />
 
<telerik:RadUpload ID="RadUpload1" runat="server" FocusOnLoad="True" MaxFileInputsCount="3"
    ToolTip="Select Image to upload" Skin='<%# RadFormDecorator1.Skin %>'>
</telerik:RadUpload>
 
</form>
</body>
</html>


Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Growls
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Growls
Top achievements
Rank 1
Share this question
or