inheritance issue with skins

5 posts, 1 answers
  1. Brandon
    Brandon avatar
    5 posts
    Member since:
    Jun 2007

    Posted 13 Aug 2008 Link to this post

    hi telerik,

    I am having an issue when I inherit from the RadDatePicker and the skin not rendering correctly (except the default skin), consider the following which will render two identical date pickers on the form (using the default skin):

    (note: using RadControls for ASPNET AJAX Q1 2008)

    <%@ Page Language="C#" %>
    <%@ register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

    <script type="text/C#" runat="server">

    public class DatePicker : Telerik.WebControls.RadDatePicker
    {
    public DatePicker ( ) : base ( )
    {

    }
    }

    protected void Page_Load ( object sender, EventArgs e )
    {
    DatePicker dp = new DatePicker ( );
    this.ph.Controls.Add ( dp );
    }

    </script>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>DatePicker WTF</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>

    <telerik:raddatepicker runat="server" id="RadDatePicker1" />

    <asp:placeholder runat="server" id="ph" />

    </div>
    </form>
    </body>
    </html>

    Now, if I modify both RadDatePicker's to use a different theme, say Web20, the datepicker rendered in the ASPX markup renders fine, but the inherited control fails to render correctly (seven 404 erros looking for css and gif files)

    <%@ Page Language="C#" %>
    <%@ register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

    <script type="text/C#" runat="server">

        public class DatePicker : Telerik.WebControls.RadDatePicker
        {
            public DatePicker ( ) : base ( )
            {
                base.Skin = "Vista";
            }
        }

        protected void Page_Load ( object sender, EventArgs e )
        {
            DatePicker dp = new DatePicker ( );
            this.ph.Controls.Add ( dp );
        }
       
    </script>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>DatePicker WTF</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
           
                <telerik:raddatepicker runat="server" id="RadDatePicker1" skin="Vista" />
               
                <asp:placeholder runat="server" id="ph" />
           
            </div>
        </form>
    </body>
    </html>

    any ideas appreciated?

    thanks

    Matthew

  2. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 14 Aug 2008 Link to this post

    hi

    Try setting the ID property. Here is an example:

    public class DatePicker : Telerik.WebControls.RadDatePicker 
        public DatePicker ( ) : base ( ){} 
     
     
    protected void Page_Load ( object sender, EventArgs e ) 
    {    
        DatePicker dp = new DatePicker ( ); 
        dp.ID = "MyDatePicker"
        this.ph.Controls.Add ( dp ); 



    Regards...
    <John:Peel />
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brandon
    Brandon avatar
    5 posts
    Member since:
    Jun 2007

    Posted 14 Aug 2008 Link to this post

    Hi John, thanks for the suggestion (ashamed I didn't think of that one) ...but alas, still no joy..

    did notice something odd though, checking the output HTML showed the following for the ASPX markup declared control:

    <div id="RadDatePicker1_wrapper" class="pickerWrapper_Vista " style="display:-moz-inline-stack;width:150px;height:20px;"
        <!-- 2008.1.619.20 --> 

    and for the inherited control, it renders the following:

    <div id="myRadDatePicker_wrapper" class="pickerWrapper_Vista" style="display:-moz-inline-stack;width:150px;height:20px;"
        <!-- 2.2.5 --> 

    Now, I am not exactly sure what these HTML comments represent, but I assume they are some form of version number ...just odd that the inherited controls renders a different string?

    Thanks again
  5. Answer
    John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 14 Aug 2008 Link to this post

    hi


    The green tag represents ver. of the control.


    <!-- 2.2.5 -->  - RadCalendar for ASP.NET (Classic RadControls)

    <!-- 2008.1.619.20 -->  - RadCalendar for ASP.NET AJAX (Prometheus RadControls)


    Thank you...
    <John:Peel />


  6. Brandon
    Brandon avatar
    5 posts
    Member since:
    Jun 2007

    Posted 14 Aug 2008 Link to this post

    Thanks again John, got it!!  ..I was inheriting from the wrong control ...derr!!!

    no good:

    public class DatePicker : Telerik.WebControls.RadDatePicker 

    good:

    public class DatePicker : Telerik.Web.UI.RadDatePicker 

    THANKS!!


Back to Top
UI for ASP.NET Ajax is Ready for VS 2017