attempts to set RadTimePicker

2 posts, 0 answers
  1. matt
    matt avatar
    259 posts
    Member since:
    Oct 2007

    Posted 17 Oct 2008 Link to this post


    i am using a RadTimePicker in my RadGrid's EditForm's UserControl. like so:

    <Telerik:RadTimePicker id="rdpArrestTime" SelectedDate='<%# Eval("ArrestDateTime") %>' DateInput-DateFormat="HH:mm" Width="97" TimePopupButton-Visible="false" TabIndex="22" Runat="server" /> 

    ...this doesnt seem to work when the db-value is NULL.

    how does one set it?

  2. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 17 Oct 2008 Link to this post

    Hey Matt,

    You can use the OnDataBinding event to perform a custom handling of the data...  For example:

    <Telerik:RadTimePicker id="rdpArrestTime" SelectedDate='<%# Eval("ArrestDateTime") %>' DateInput-DateFormat="HH:mm" Width="97" TimePopupButton-Visible="false" TabIndex="22" Runat="server" OnDataBinding="CheckNull"/>  

    And then in code-behind (here's mind to auto-decode bound data):

        protected void DecodeText(object sender, EventArgs e)  
            ((RadTimePicker)sender).Text = HttpUtility.HtmlDecode(((Literal)sender).Text);  

    So you'd basically check for null on the data and replace as necessary.
Back to Top