Master Pages & Telerik Controls

6 posts, 0 answers
  1. James
    James avatar
    20 posts
    Member since:
    Oct 2008

    Posted 03 Mar 2009 Link to this post

    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

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts
    Member since:
    Sep 2012

    Posted 06 Mar 2009 Link to this post

    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.

  3. DevCraft Release
  4. Kevin
    Kevin avatar
    61 posts
    Member since:
    Oct 2008

    Posted 09 Mar 2009 Link to this post

    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.

  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts
    Member since:
    Sep 2012

    Posted 11 Mar 2009 Link to this post

    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.

  6. ewart
    ewart avatar
    221 posts
    Member since:
    Jan 2007

    Posted 04 Apr 2009 Link to this post

    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

  7. Dimo
    Admin
    Dimo avatar
    7497 posts
    Member since:
    Sep 2012

    Posted 07 Apr 2009 Link to this post

    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.

Back to Top
DevCraft Release