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

Master Pages & Telerik Controls

5 Answers 468 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 03 Mar 2009, 03:56 PM
I am in the process of adding TELERIK controls to our applications. I am trying to figure out the 'best practice' in regards to using master pages and telerik controls.

Currently I have the requirement to add a splitter on various pages and on some pages the splitter would also include other telerik controls, ie Pane, SlidingPane and Panel bar. It's makes sense to me to add the splitter to the master page and possibly add the
other controls dynamically as required. Also all of our existing pages utilize the master page so additional items added would need to have minimal impact on the existing pages. 

I guess I am asking if anyone added controls to master pages and make the visible as required and also is there an example somewhere that will show how to add telerik controls to an existing page dynamically, for example if I add just a splitter in the master page, in a existing page that uses this masterpage how would I add pane, slidingpane and panelbar to the splitter dynamically from the codebehind page, or is this idea just crazy? Which it could be!

Thanks,
Jim D

5 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 06 Mar 2009, 11:58 AM
Hi James,

There is no problem to use RadControls along with MasterPages. The only difference is that the MasterPage is an INaming container and changes the IDs of the controls it contains - this is how the MasterPages work and this is so for all controls, not only RadControls but standard controls, too. This being said, if you use MasterPages, to reference controls later you should use their ClientIDs.

As to dynamic creation of objects, you can create and add the objects in the standard manner you do with other controls. You can find a demo of dynamic created splitter below:

http://demos.telerik.com/aspnet-ajax/splitter/examples/dynamicobjectcreation/defaultcs.aspx 

Best wishes,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 2
answered on 09 Mar 2009, 08:35 PM
We've had pretty good luck so far with master pages as well.  We have multiple master pages.  For example master page for all dialog windows (RadWindows), master page for certain sections of the app, etc.

We do the following types of things in the master pages to centralize efforts:
* include links to standard css files
* include links for the custom skin we use in our app
* include common js used throughout the app
* provide common radajaxloadingpanel
* provide common radscriptmanager
* provide common radajaxmanager
* provide common radwindowmanager

The only real "controls" we put in the master pages are things related to navigation elements.

Had to play some games taking the masterpage approach.  For example we have a radwindowmanager in a masterpage.  It pre-defines a common radwindow available from all pages - a pop-up help window.  However many pages have their own set of radwindows they use specific to that particular page.  So, we have dynamic code that adds additional radwindows to that radwindowmanager on a page by page basis when necessary.

Not sure if this is all "best practice or not but that's how it's shaken out for us so far.

0
Svetlina Anati
Telerik team
answered on 11 Mar 2009, 02:21 PM
Hello Kevin,

It is good that you have placed the RadWindowManager on the MasterPage - in this manner you can open popups from every other page. However, you can have and use separate RadWindows on other pages and it is not necessary to add them to the RadWindowManager. I recommend to add and use them separately as any other server control.

Regards,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
ewart
Top achievements
Rank 1
answered on 04 Apr 2009, 10:13 PM
Hi, I am trying to come to grips with best practise here too.  I reference the telerik grid and find I'm inserting a link outside of the body tags, so my page won't validate.  How can I @register in such a way that the link appears in the correct position?

I didn't initially declare any telerik assembly in my master pages (I'd prefer not to until I have use it thoughtout all pages), and I figured I just needed to move the declartion there to fix.. (and a correspoding register in the detail page)... but that didn't work.

the source for the page:
http://www.onesportevent.com/Detail.aspx?eventid=2623

the link:
<link class='Telerik_stylesheet' type='text/css' rel='stylesheet' href='/WebResource.axd?d=iPoDV0O../>

validating my page with w3c:
http://validator.w3.org/check?uri=http%3A%2F%2Fonesportevent.com%2FDetail.aspx%3Feventid%3D2669%263&charset=%28detect+automatically%29&doctype=Inline&group=0

Current master page
<%@ Master Language="VB" CodeFile="MEvents.master.vb" Inherits="Events" %> 
<%@ 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" dir="ltr">  
<head profile="http://gmpg.org/xfn/11">  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <meta name="copyright" content="www.onesportevent.com" /> 
    <link rel="stylesheet" href="Style/style.css" type="text/css" media="screen" /> 
<asp:ContentPlaceHolder id="head" runat="server">  
</asp:ContentPlaceHolder> 
</head> 
<body id="master">  
.. 


my current detail page:
<%@ Page Language="VB" MasterPageFile="~/MEvents.master" AutoEventWireup="false" CodeFile="Detail.aspx.vb" Inherits="Subevents" %> 
<%@ Register tagprefix="telerik" namespace="Telerik.Web.UI"  %> 
 
<%@ OutputCache VaryByParam="*" Duration="300" %> 
<asp:Content ID="Content2" ContentPlaceHolderID="cplBody" Runat="Server">  
 
    <telerik:RadGrid ID="rgEvents" DataSourceID="sqlEventList" Skin="Office2007" runat="server" 
        EnableViewState="False" GridLines="None" AllowSorting="false" AutoGenerateColumns="False" 
        Width="700px">  
    ... 

I also fooled around with adding the following to the web.config as initially I had errors saying the telerik grid was an unknown server tag:
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>

regards
  ewart
0
Dimo
Telerik team
answered on 07 Apr 2009, 12:10 PM
Hi Ewart,

You have to set runat="server" to the <head> tag, otherwise all RadControls scripts and CSS files are registered in the <body>.

Using runat="server" for the <head> is a general requirement in ASP.NET 2.0.

Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
James
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Kevin
Top achievements
Rank 2
ewart
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or