RadDatePicker Style Issue

1 posts, 0 answers
  1. James
    James avatar
    1 posts
    Member since:
    Apr 2012

    Posted 30 Apr 2012 Link to this post

    I am using RadDatePicker in an application page.  The issue is that the control expands to the full page width and displays with block format instead of inline when browsing the page in IE9's compatibility mode.  How do I fix this behavior?

    Markup:
    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadDateTest.aspx.cs" Inherits="Test.SharePoint.Layouts.RadDateTest" DynamicMasterPageFile="~masterurl/default.master" %>
     
    <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
     
    </asp:Content>
     
    <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
        <asp:Panel ID="pnlControls" runat="server">
        </asp:Panel>
    </asp:Content>
     
    <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Application Page
    </asp:Content>
     
    <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
    My Application Page
    </asp:Content>


    C#:
    using System;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
     
    namespace Test.SharePoint.Layouts
    {
        public partial class RadDateTest : LayoutsPageBase
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                CreateDateField(0, "One", false);
                CreateDateField(1, "Two", true);
            }
     
            private void CreateDateField(int ID, string name, bool isRequired)
            {
                // Creates a lable with the name of the selection...
     
                Label lbl = new Label();
                lbl.Width = 160;
                lbl.ID = "lblItem" + ID.ToString();
                lbl.Text = name + ":";
                lbl.Style.Add("font-weight", "700");
                this.pnlControls.Controls.Add(lbl);
     
                // Creates a date picker text box
                RadDatePicker txt = new RadDatePicker();
                txt.Width = 230;
                txt.ID = "datItem" + ID.ToString();
                txt.Style.Add("margin-top", "3px");
                txt.Calendar.ShowRowHeaders = false;
                txt.ShowPopupOnFocus = true;
     
                this.pnlControls.Controls.Add(txt);
     
                // If it is required, then add a lable showing its required...
                if (isRequired)
                {
                    Label lblReq = new Label();
                    lblReq.ID = "lblRequired" + ID.ToString();
                    lblReq.Text = "*";
                    lblReq.Style.Add("margin-left", "15px");
                    lblReq.Style.Add("color", "Red");
                    this.pnlControls.Controls.Add(lblReq);
                }
     
                // Add a new lable for a new line feed in HTML.
                this.pnlControls.Controls.Add(new Label() { Text = "<br />" });
            }
        }
    }
Back to Top