RadDatePicker visibility

5 posts, 0 answers
  1. Joao
    Joao avatar
    12 posts
    Member since:
    Jan 2009

    Posted 23 May 2011 Link to this post

    Why this wont work? any workaround?

    Thanks
    JL

    document.getElementById('<%= rdpDataInicioContacto.ClientID %>').style.visibility = 'hidden';

    OR

    var dpi = document.getElementById('<%= rdpDataInicioContacto.ClientID %>');
    var dpf = document.getElementById('<%= rdpDataFimContacto.ClientID %>');
    dpi.style.display = "none";
    dpf.style.display = "none";
  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 23 May 2011 Link to this post

    Hi Joao,

    Try it this way. I worked up a little example for how to do this both server-side and client-side. I personally prefer the client-side approach - JavaScript is our friend.

    Here's some simple ASPX to create a RadDatePicker and two buttons.
    <telerik:RadDatePicker Runat="server" ID="RadDatePicker1">
    </telerik:RadDatePicker>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Toggle DatePicker Server-side" OnClick="RadButton1_OnClick">
    </telerik:RadButton>
    <telerik:RadButton ID="RadButton2" runat="server" Text="Toggle DatePicker Client-side" OnClientClicked="RadButton1_OnClick">
    </telerik:RadButton>

    Here's my client-side javascript.
    function RadButton1_OnClick(sender, args) {
     
        var picked = $find("<%=RadDatePicker1.ClientID %>");
        picked.set_visible(!(picked.get_visible));
     
    }

    Here's my C# from the code-behind.
    protected void RadButton1_OnClick(object sender, EventArgs e)
    {
     
        RadDatePicker1.Visible = !(RadDatePicker1.Visible);
    }

    Hope this helps!
    -Gimmik
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 May 2011 Link to this post

    Hello Joao,
    You can achieve this by setting the RadDatePicker set_visible property to false. For getting the client object of RadControls you need to you $find() method.
    Javascript:
    function hide()
    {
           var datePicker= $find('<%= RadDatePicker1.ClientID %>');
           datePicker.set_visible(false);
    }

    aspx:
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    </telerik:RadDatePicker>
    <asp:Button ID="Btn1" runat="server" Text="Hide" OnClientClick="hide();" />

    Thanks,
    Princy.
  5. Joao
    Joao avatar
    12 posts
    Member since:
    Jan 2009

    Posted 23 May 2011 Link to this post

    Thank You, worked.
  6. Joao
    Joao avatar
    12 posts
    Member since:
    Jan 2009

    Posted 23 May 2011 Link to this post

    Hi, also a great option, thanks
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017