Can I combine RadDatePicker and TextboxSetting?

6 posts, 1 answers
  1. Web team
    Web team avatar
    57 posts
    Member since:
    Mar 2010

    Posted 12 May 2010 Link to this post

    I have tons of textboxes and datepickers. I tried pointing the IDs of the datepickers to the target input of Textboxsettings for required field validation but it seems it does not work.

    I know that I can use a normal asp.net validation but I like the way textboxsetting shows the validation message inside the textbox which is not (straightforward) possible in a normal asp.net validation control. 
  2. Web team
    Web team avatar
    57 posts
    Member since:
    Mar 2010

    Posted 12 May 2010 Link to this post

    i am currently trying using multiple textboxes using shared datepickers as shown in the demos, hopefully it will work. My question is where can I get the datepicker image as i will explicitly set the path of the image? Thanks.
  3. Dimo
    Admin
    Dimo avatar
    8471 posts

    Posted 13 May 2010 Link to this post

    Hi Arnold,

    RadInputManager has been designed to work with regular asp:TextBoxes, not RadDatePickers or RadTextBoxes.

    You can either use a non-embedded popup image as in this online demo...

    http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/shareddatepicker/defaultcs.aspx

    ...or you can use an embedded image like this:

    <asp:Button ID="Button1" runat="server" class="popupButton" />

    <telerik:RadCodeBlock ID="asdf" runat="server">
    <style type="text/css">

    .popupButton
    {
        border:0;
        padding:0;
        width:22px;
        height:22px;
        background:transparent no-repeat 0 0 url(<%= Page.ClientScript.GetWebResourceUrl(typeof(RadCalendar), "Telerik.Web.UI.Skins.Sunset.Calendar.sprite.gif") %>);
    }

    </style>
    </telerik:RadCodeBlock>


    The above CSS code should be placed in the <head> of the page.


    Regards,
    Dimo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. Web team
    Web team avatar
    57 posts
    Member since:
    Mar 2010

    Posted 13 May 2010 Link to this post

    i used the shared datepicker (like in the demo) then I point the custom textboxes to the textboxsettings. when i select a date by clicking the textbox, the textbox css changes to look like it is active. the font color in the textbox is black. however, when i select a date using the image of the datepicker the textbox of the css doesnt change and it look like inactive - font is gray. please see attach pic.
  5. Answer
    Dimo
    Admin
    Dimo avatar
    8471 posts

    Posted 13 May 2010 Link to this post

    Hello Arnold,

    The problem is in the way you are setting the textbox value - the RadInputManager doesn't know about this, so it doesn't update the textbox styles. Please either set the value using the RadInputManager API or refresh the textbox styles manually.


    <telerik:RadInputManager ID="RadInputManager1" runat="server">
        <telerik:DateInputSetting EmptyMessage="empty">
            <TargetControls>
                <telerik:TargetInput ControlID="TextBox1" />
            </TargetControls>
        </telerik:DateInputSetting>
    </telerik:RadInputManager>
     
    <asp:TextBox ID="TextBox1" runat="server" />
     
    <asp:Button ID="Button1" runat="server" Text="set date value" OnClientClick="return setv()" />
     
    <script type="text/javascript">
     
    function setv()
    {
        //use this
        $find("<%= RadInputManager1.ClientID %>").get_targetInput("<%= TextBox1.ClientID %>").set_value("5/5/2010");
         
        //or this
        //$get("TextBox1").value = "5/5/2010";
        //$find("<%= RadInputManager1.ClientID %>").get_targetInput("<%= TextBox1.ClientID %>").updateCssClass();
         
        return false;
    }
     
    </script>


    Kind regards,
    Dimo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Web team
    Web team avatar
    57 posts
    Member since:
    Mar 2010

    Posted 13 May 2010 Link to this post

    that works thanks!
Back to Top