How do I render a textbox in each day of the calendar

4 posts, 0 answers
  1. Marshall Moorman
    Marshall Moorman avatar
    8 posts
    Member since:
    Sep 2007

    Posted 10 Dec 2009 Link to this post

    I am trying to render a textbox for each day of a calendar, but I am getting an exception.

    Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

    Can someone tell me how to accomplish this?

    <telerik:RadCalendar ID="calendar" Width="500px" Height="400px" runat="server" OnDayRender="calendar_DayRender">  
                <CalendarDayTemplates> 
                    <telerik:DayTemplate ID="templateMinutes">  
                        <Content> 
                            <telerik:RadTextBox ID="txtMinutes" runat="server" Columns="5">  
                            </telerik:RadTextBox> 
                        </Content> 
                    </telerik:DayTemplate> 
                </CalendarDayTemplates> 
            </telerik:RadCalendar> 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Dec 2009 Link to this post

    Hello Marshall,

    Try adding the textbox in DayRender event and see whether it meets your requirement. Here is the code that I tried.

    CS:
     
        protected void calendar_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) 
        { 
            TextBox text = new TextBox(); 
            text.Text = e.Day.Date.ToString();
            e.Cell.Controls.Add(text); 
        } 

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marshall Moorman
    Marshall Moorman avatar
    8 posts
    Member since:
    Sep 2007

    Posted 11 Dec 2009 Link to this post

    That works, but I am wanting to use a RadTextBox instead of just an ASP TextBox.
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 16 Dec 2009 Link to this post

    Hi Marshall,

     
    To implement the desired by you functionality, I suggest that you add the RadTextBox to a Day Template and use it for all dates.

    Give this suggestion a go and let me know how it goes.


    Greetings,
    Mira
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top