<telerik:GridDateTimeColumn UniqueName="date" DataField="date" HeaderText="Date" ItemStyle-Width="120px"></telerik:GridDateTimeColumn> |
I have a FormTemplate with this line:
<telerik:RadDatePicker ID="datenews" runat="server" SelectedDate='<%# Bind("date") %>'> |
When I edit a record, this works fine.
When I go to insert a new record I get this:
System.InvalidCastException: Specified cast is not valid |
On the RadDatePicker line above.
Help?
Second question:
I tried to avoid creating the FormTemplate in the first place and use the automatically generated edit / insert form. I could not locate how to manipulate (change width, height, textmode) the text boxes automatically created.
7 Answers, 1 is accepted
Onto your questions:
- You need to bind the DbSelectedDate property of the date picker instance to avoid the exception (since it is of nullable type and can intercept null value on init insert operation). See this demo for more details:
http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/databinding/defaultcs.aspx - For the second part you can use declarative style editors as explained in this help topic. For more flexible edit form customization you can use FormTemplate or WebUserControl custom edit form.
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.


I deleted the old dll from the project.
I added a reference to the new DLL.
I closed VS2008 and reopened it.
The new DLL is in the project.
There is no evidence of DbSelectedDate - what am I doing wrong?
Since the DbSelectedDate is nullable property, it is not displayed when using the Visual Studio Intellisense. Nevertheless, specifying this property value through the date picker tag should do the trick.
I am sorry to hear that you are having a hard time finding the information you need in the support resources available for our products. I encourage you to explore the resources linked in the footer of this message which provide useful tips about how to optimize your support resources searches.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

I know this post is very old... perhaps someone else will come across it and painfully waste their time looking for instructions that don't work... I wish this old stuff would get deleted.
BTW, the practice hasn't changed. I still use this product (2015 Q2) because it's paid for but I'm phasing it out. At the moment, I have to fix something that gives me the same error message but on a RadButton in a RadGrid. Click the "insert" button to begin adding a record (all out-of-the-box stuff) and I get this error. Why? I suppose because SQL usings bit and they use boolean and something gets lost in translation.
I'm guessing the fix is to use back-mark up because front-end mark up won't work.
Oh when will I learn...

I am sorry that you are facing such issues and that our controls are not suitable for your project anymore. We do try to test, and we have a great many scenarios covered. The possibilities in a real application are, however, endless, and in all likelihood there is something we haven't thought of.
If you need help with this case, I encourage you to open a ticket and send us a small mockup of the problem so we can take a look.
It is even possible that we have fixed it in a later version, so you can give R1 2018 a quick test to see if it works as expected for you.
I have also added a noindex robots meta tag to this page as it is, indeed, quite old (from 2009), so hopefully Google will honor it and stop putting it in results.
Regards,
Marin Bratanov
Progress Telerik