calendar question

1jaws
1jaws used Ask the Experts™
on
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">
                                        <SpecialDays>
                                            <radCln:RadCalendarDay Repeatable="Today" />
                                        </SpecialDays>
                                    </Calendar>
                                </radCln:RadDatePicker>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
http://www.telerik.com/products/aspnet-ajax/calendar.aspx

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.

Author

Commented:
yes, I looked at that and couldnt figure it out myself..
http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/custompopup/defaultcs.aspx

<li>dateinput format
                    <telerik:RadComboBox ID="rcbDateFormat" runat="server" AutoPostBack="true" Width="100px">
                        <Items>
                            <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" />
                        </Items>
                    </telerik:RadComboBox>
                </li>

Author

Commented:
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>

</radCln:RadDatePicker>

change this format and c if it works or not.

Author

Commented:
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;  
    RebindGrid();  
}  

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

http://www.telerik.com/community/forums/aspnet/calendar/datapicker-not-insert-time-in-database.aspx

Author

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

Author

Commented:
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 =
<EditItemTemplate>
    <telerik:RadDatePicker id="picker1" MinDate="2006/1/1" runat="server" DbSelectedDate='<%# Bind("Dates") %>'>
    </telerik:RadDatePicker>
</EditItemTemplate>

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.

Author

Commented:
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