This is a migrated thread and some comments may be shown as answers.

assign value to RadDatePicker from database

1 Answer 235 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Hadoop
Top achievements
Rank 1
Hadoop asked on 25 Jun 2015, 04:23 PM

I've to populate the RadDatePicker from database. From database, i am accessing the data value as string. I am having problem to set that value to RadDatePicker.

Form sample ::

<table>
    <tr>
        <td>Date of Birth : </td>
        <td>
            <telerik:RadDatePicker ID="dtp_DOB" runat="server"></telerik:RadDatePicker>
        </td>
    </tr>      
</table>

in code behing page ::

DataTable dt = GetPersonalDetails(p_id);
 
if (dt != null && dt.Rows.Count > 0)
{
    DataRow dr = dt.Rows[0];       
    string DOB_ = dr["DateOfBirth"].ToString();
    dtp_DOB.SelectedDate = ????
}

How to show the date retrieved from database to RadDatePicker? Please help.

1 Answer, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 30 Jun 2015, 08:43 AM
Hi,

As the data-binding documentation article states:
When embedding the RadDatePicker control inside a data-bound control, use a data-binding expression to bind the value of the input control to the data source of the parent control. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression,you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.
Revise the provided help topic and see if it helps.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DatePicker
Asked by
Hadoop
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or