1jaws
asked on
calendar question
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>
<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>
ASKER
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>
<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>
ASKER
I dont use <telerik: I use <radCln so I dont know how will I use that ..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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...
2010-06-22 00:00:00.000 I need to be able to select this date...
private void DataGrid1_UpdateCommand(ob ject source, DataGridCommandEventArgs e)
{
RadDatePicker picker = (RadDatePicker) e.Item.FindControl("picker 1");
object newDate = ((DateTime)picker.DbSelect edDate).To String("dd /MM/yyyy") ;
DataSource.Rows[e.Item.Dat aSetIndex] ["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
{
RadDatePicker picker = (RadDatePicker) e.Item.FindControl("picker
object newDate = ((DateTime)picker.DbSelect
DataSource.Rows[e.Item.Dat
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
ASKER
I am not using datagrid, it is just outside the grid...
ASKER
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 =
pickdate.SelectedDate = String.Format("{0:yyyy/MM/
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,@ DateWorksh op) AS VARCHAR(4)) + '-' + CAST(DATEPART(month,@DateW orkshop) as VARCHAR(2)) + '-' + CAST(DATEPART(day,@DateWor kshop) 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.
<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,@
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.
ASKER
Not using datagrid... and above code I just deleted String.format part and it works.. thanks for the helpp..
ur welcome
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.