Read content of created control

2 posts, 0 answers
  1. David Penny
    David Penny avatar
    174 posts
    Member since:
    Jun 2006

    Posted 12 Aug 2013 Link to this post

    Hi,

    I have a scenario where I want the user to be able to type in the number of hours to allocate to a task on the Calendar. To do this I have created a textbox to enter the data into using:

    Protected Sub RadCalendar1_DayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs) Handles RadCalendar1.DayRender
        Dim label As New Label()
        label.Text = e.Day.[Date].Day.ToString()
        e.Cell.Controls.Add(label)
        Dim dayOfWeek As String = e.Day.[Date].DayOfWeek.ToString()
        If dayOfWeek <> "Saturday" And dayOfWeek <> "Sunday" Then
            Dim txtBox As New TextBox()
            txtBox.Text = "xx" 'Will be read from database
            e.Cell.Controls.Add(txtBox)
        End If
    End Sub

    The question I have now is how to I read all the days of the Calendar, get the contents of each textBox and do something with it? I would like to do this server side.

    I've spent some time with the documentation without finding anything that fits the bill.

    David Penny
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 15 Aug 2013 Link to this post

    Hello David,

    I am sorry to say but the server-side API does not expose a method which allows the traversing of the day cells. That said you can meet the requirements in two ways:
    1. Attach an event handler for the OnTextChanged event of the text boxes inside the cells and once the value in one of them is changed on the server store it in a separate structure.
    2. Do the same but on the client and send the information via an AJAX request.

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top