RadTimePicker- Hide on server side and show/hide on client side

4 posts, 0 answers
  1. Joshy Varghese
    Joshy Varghese avatar
    10 posts
    Member since:
    Mar 2009

    Posted 29 Jul 2011 Link to this post

    Hi
    I'm using a RadTimePicker in an edit form of the grid. I just want to hide the control from server side and show/hide the control from client side.
    client side show/ hide is working with following code.

    function checkboxClick(chkBox, timePicker) {
     var chkBox1 = document.getElementById(chkBox);
     var timePicker1= $find(timePicker);
     if (chkBox1 .checked) {
      timePicker1.set_visible(true);
     }
     else {
      timePicker1.set_visible(false);
     }
    }

    I can hide the RadTimePicker from server side usnig the following code but I can't show/hide the control from above javascript code.
    timePicker.Style.Add("visibility", "hidden");

    Please help!!

    Thanks!

     

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Aug 2011 Link to this post

    Hello Joshy,

    Try the following code snippet to hide RadTimePicker from server side in ItemDataBound event.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
      if (e.Item is GridEditableItem && e.Item.IsInEditMode)
      {
          GridEditableItem item = (GridEditableItem)e.Item;
          RadTimePicker pkr = (RadTimePicker)item.FindControl("timePicker1");
          pkr.Visible = false;
      }
    }

    Thanks,
    Princy.
  3. Joshy Varghese
    Joshy Varghese avatar
    10 posts
    Member since:
    Mar 2009

    Posted 01 Aug 2011 Link to this post

    Hi Princy,
    I know we can hide the control on server side with your code. I want to hide the control from server side and show/hide from client side(javascript) as well.
    I need help on this scenario.

    Thanks!
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 Aug 2011 Link to this post

    Hi Joshy,

    Unfortunately the required functionality is not supported out of the box. It is not possible to hide the control on the server using visible="false" and show it on the client. Possible approach in this case is to set display:none on the server and display:block on the client to show the control.


    Regards,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top