<
telerik:RadDateInput ID="diPremiumDueDate" runat="server" DateFormat="M/d/yyyy"
DbSelectedDate='<%# Eval("PremiumDueDate") %>'>
But I get an error when this value is null in my database. How do I get around this? I'd like the value to be blank on my web page when this happens.
Thanks,
Bob
8 Answers, 1 is accepted
Have you tried using the Bind() mehod instead of the Eval():
<telerik:RadDateInput ID="diPremiumDueDate" runat="server" DateFormat="M/d/yyyy" |
DbSelectedDate='<%# Bind("PremiumDueDate") %>'> |
Additionally, you could have a look at this online demo. I hope this helps.
Regards,
Iana
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I tried Bind instead of Eval but I get the same error. Here is the error:
Sys.WebForms.PageRequestManagerServerErrorException: Value of "1/1/001 12:00:00 AM" is not valid for selected date. Selected Date should be between MinDate and MxDate.
If I look at my date in my SQL table it is clearly Null. But I notice it is 01/01/0001 in my radGrid. I have an Edit button for each row in my radGrid and when clicked is when I get this error. My Edit button calls a user control. JNust for fun, I used MinDate = "01/01/0001" in my HTML. It did not bomb out but instead displayed with 01/01/0001. I just want it be blank in this case.
Thanks,
Bob
I followed your scenario and prepared a sample project for you. Please, find it attached to this post. Give it a try and let me know if I missed something from your code/logic. Please check if you are using the last version of RadControls for ASP.NET AJAX - Q1 2008 labeled 2008.1.415.
Let us know if this helps.
Sincerely yours,
Iana
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Could you please elaborate more on your scenario? Are you setting the DateTimePicker SelectedDate through binding expression? If the date assigned to the DateTimePicker is coming from database you should use the DbSelectedDate property to set the picker value. Thus if the returned value is null, the textbox will be empty.
Review this demo for more information about RadDateTimePicker data-binding.
Let us know how it goes.
Sincerely yours,
Iana
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
The scenario is I'm updating an existing record inside the EditItem template of a formview control. The date in the DB is null, the user selects a data and hits the save THe problem is
that I am getting back "" when I do a
FinalAcceptanceDate = (DateTime)e.NewValues["Final_Acceptance_Date"];
inside the ItemUpdating event handler for the Formview..
Here is my Markup:
<radCln:RadDatePicker ID="raddt_FinalAccpt" runat="server" CssClass="FieldInputsm"
DbSelectedDate='<%# Bind("Final_Acceptance_Date") %>' SharedCalendarID="radCal" ToolTip='<%# Bind("Final_Acceptance_Date") %>'
Width="90%" TabIndex="8">
</radCln:RadDatePicker>
Please find attached a sample project where RadCalendar works as expected in FormView edit template. Try it on your end and let me know if I missed something from your logic.
Greetings,
Iana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.