calendar question

1jaws used Ask the Experts™
I have this code.. and shows this format when I picked the date, I want yyyy,mm,dd format how can I do that? Second, while reading back from database how would I select that date whatever comes from database?

<radCln:RadDatePicker ID="pickdate" runat="server" Width="140px" AutoPostBack="true"
                                     MinDate="01/01/1000" MaxDate="01/01/3000">
                                    <Calendar runat="server">
                                            <radCln:RadCalendarDay Repeatable="Today" />
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Above is the link with information you may use to work on. You can set you data format property for the control in which ever form you want.


yes, I looked at that and couldnt figure it out myself..

<li>dateinput format
                    <telerik:RadComboBox ID="rcbDateFormat" runat="server" AutoPostBack="true" Width="100px">
                            <telerik:RadComboBoxItem Text="d" Value="d" Selected="true" />
                            <telerik:RadComboBoxItem Text="D" Value="D" Selected="true" />
                            <telerik:RadComboBoxItem Text="dd/MMM/yyyy" Value="dd/MMM/yyyy" />
                            <telerik:RadComboBoxItem Text="dd/MMM/yy" Value="dd/MMM/yy" />


I dont use <telerik: I use <radCln  so I dont know how will I use that ..
<radCln:RadDatePicker ID="RadDateValidUntil"  runat="server" >

<DateInput DateFormat="dd-MMM-yyyy">                  </DateInput>


change this format and c if it works or not.


OK I just added to dateformat to above it worked.. now I need to read from database using reader to select the date comes it comes back from the database.. it comes back from db like this
2010-06-22 00:00:00.000  I need to be able to select this date...
private void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e)  
    RadDatePicker picker = (RadDatePicker) e.Item.FindControl("picker1");  
    object newDate = ((DateTime)picker.DbSelectedDate).ToString("dd/MM/yyyy");  
    DataSource.Rows[e.Item.DataSetIndex]["Dates"] = newDate;  
    DataGrid1.EditItemIndex = -1;  

I am also pasting the site where I got this I think you should be able to go get it work from this information.


I am not using datagrid, it is just outside the grid...


if(reader["Date"]!= null)
                           pickdate.SelectedDate = String.Format("{0:yyyy/MM/dd}", (DateTime)reader["Date"]);

something like but it complains for the right side the =
    <telerik:RadDatePicker id="picker1" MinDate="2006/1/1" runat="server" DbSelectedDate='<%# Bind("Dates") %>'>

UpdateCommand="UPDATE [tblAgenda]  
SET [DateWorkshop] = CAST((CAST(DATEPART(year,@DateWorkshop) AS VARCHAR(4)) + '-' + CAST(DATEPART(month,@DateWorkshop) as VARCHAR(2)) + '-' + CAST(DATEPART(day,@DateWorkshop) AS VARCHAR(2))) as VARCHAR(10))  
WHERE [AgendaID] = @AgendaID

And also the link which I pasted in my previous comment should help you in binding date with database take a look at it.


Not using datagrid... and above code I just deleted   String.format part and it works.. thanks for the helpp..
ur welcome

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial