How to hide dynamically added control from particular date slot

2 posts, 1 answers
  1. Manish
    Manish avatar
    64 posts
    Member since:
    Jul 2011

    Posted 24 Aug 2012 Link to this post

    Hi,

    I have a scheduler and i am adding dynamic Image button in every slot but i need to remove that image button from some slots in which i have data. so please tell me some solution.
     
    I am adding Image button by this:

     protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
            {
                ImageButton btn = new ImageButton();
                btn.ImageUrl = "~/Images/Add.png";
                btn.CssClass = "FloatRight";
                e.TimeSlot.Control.Controls.AddAt(0, btn);
                btn.CommandName = "btn";
                btn.CommandArgument = e.TimeSlot.Start.Date.ToString();
                btn.Command += new CommandEventHandler(GoToUnitNumber);          
            }

    Please check the attachment
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Aug 2012 Link to this post

    Hi Manish,

    Try the following code snippet to achieve your scenario.

    C#:
    protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
     {
       if (e.TimeSlot.Appointments.Count == 0)
         {
            ImageButton btn = new ImageButton();
            btn.ImageUrl = "~/Images/Add.png";
            btn.CssClass = "FloatRight";
            e.TimeSlot.Control.Controls.AddAt(0, btn);
            btn.CommandName = "btn";
            btn.CommandArgument = e.TimeSlot.Start.Date.ToString();
            btn.Command += new CommandEventHandler(GoToUnitNumber);       
         
     }

    Hope this helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top