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

inheritance issue with skins

4 Answers 94 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 13 Aug 2008, 11:12 PM

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

4 Answers, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 14 Aug 2008, 11:03 AM
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 />
0
Brandon
Top achievements
Rank 1
answered on 14 Aug 2008, 12:40 PM
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
0
Accepted
plamen
Top achievements
Rank 1
answered on 14 Aug 2008, 01:37 PM
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 />


0
Brandon
Top achievements
Rank 1
answered on 14 Aug 2008, 01:47 PM
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!!


Tags
Calendar
Asked by
Brandon
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
Brandon
Top achievements
Rank 1
Share this question
or