This is a migrated thread and some comments may be shown as answers.

DatePicker Insert

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
cursive34
Top achievements
Rank 1
cursive34 asked on 26 Dec 2008, 04:02 PM
Template Column with a DatePicker. Going into edit works fine but on insert i get an 'Specific Cast Invalid' error.

                                <telerik:GridTemplateColumn HeaderText="Start Date" UniqueName="StartDate">
                                    <ItemTemplate>
                                        <asp:Label ID="lblStartDate" runat="server" Text='<%# Bind("StartDate") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadDatePicker ID="rdpStartDate" SelectedDate='<%# Bind("StartDate") %>' runat="server">
                                        </telerik:RadDatePicker>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Steve Y
Top achievements
Rank 2
answered on 27 Dec 2008, 05:15 AM
Hi.

What type of data source are you using and what is the datatype of StartDate?

I use a LinqDataSource and I do the following two things to solve this issue if the datatype is DateTime.

1. Change SelectedDate='<%# Bind("StartDate") %>' to be DbSelectedDate='<%# Bind("StartDate") %>'

2. I add the following to the LinqDataSource if I've allowed nulls:

<UpdateParameters> 
        <asp:Parameter Name="StartDate" Type="DateTime" ConvertEmptyStringToNull="true" /> 
</UpdateParameters>
 

Regards,
Steve
Tags
Grid
Asked by
cursive34
Top achievements
Rank 1
Answers by
Steve Y
Top achievements
Rank 2
Share this question
or