RadDatePicker inside of a Form Template

3 posts, 1 answers
  1. Dale
    Dale avatar
    15 posts
    Member since:
    Sep 2015

    Posted 23 Nov 2016 Link to this post

    I have a RadDatePicker inside of a Form Template.  I can access the dbselected value from code behind, though I want to take the month and day of the dbselected value and populate an asp:textbox with the month, and a RadNumericTextBox with the day.


    The structure is

    1. RadGrid

    2. MasterTableView

    3. EditFormSettings

    4. Form Template

    5. Then tables/rows/cells containing labels, textboxes, etc.


    From code behind I can access all the asp and telerik items in the tables and retrieve any data for further use in my application by using the following code:


    If e.CommandName = RadGrid.UpdateCommandName Then
                If TypeOf e.Item Is GridEditFormItem Then
                    Dim item As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
                    Dim theClient As TextBox = DirectCast(item.FindControl("txtClient"), TextBox)
                    Dim theOrder As TextBox = DirectCast(item.FindControl("txtOrder"), TextBox)
      Dim theRadDateOrder As RadDatePicker = DirectCast(item.FindControl("RadDatePickerOrderDate"), RadDatePicker)


    I now have the value from the dbSelectedDate:

                    Dim theDateOrderDate As DateTime = theRadDateOrder.DbSelectedDate
                    Dim theDateOrderMonth As String = theDateOrderDate.ToString("MMMM")
                    Dim theDateOrderDay As String = theDateOrderDate.Day

    And I now have a month and I have a day broke out.

    Now within the form template is an asp:textbox that I want to update/insert/place the month value into.  I also have  a RadNumericTextBox that I want to update/insert/place the day value into.

    What I want to do is update the month and day on the form when the date is selected with the RadDatePicker.

    All the above was figured out by searching the internet and putting the pieces together. 

    I have not been able to find even a starting point on my question, it may be in the above code, but I do not see it yet.

    My question is how do I do this from code behind as I cannot access the controls directly as they are within the Form Template?


    Thank you for your time.  Dale



  2. Answer
    Eyup avatar
    3385 posts

    Posted 28 Nov 2016 Link to this post

    Hello Dale,

    You can achieve this requirement either on client and server side:

    You can examine the RadGridEditComboClientHideModified.zip web site sample provided in the following post:


    Enable the AutoPostback property of the picker. Using its selected change event handler, you can access the grid item: (sender as RadDatePicker).NamingContainer as GridEditableItem. Once you have the instance of the grid edit form item, then you can just use FindControl get the textbox and the numbox:

    I hope this will prove helpful.

    Telerik by Progress
    Telerik UI for ASP.NET Core is ready for Visual Studio 2017 RC! Learn more.
  3. Dale
    Dale avatar
    15 posts
    Member since:
    Sep 2015

    Posted 02 Dec 2016 in reply to Eyup Link to this post

    Thank you this is just what I needed.
Back to Top