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

Inline Add a record in Telerik Grid Throws error Specifies cast is not valid

2 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hrushikesh Mokashi
Top achievements
Rank 1
Hrushikesh Mokashi asked on 27 Jan 2009, 07:34 AM
Hi,

I m using telerik grid with inline Add/edit.
In this grid i have 2 template columne having rad datepicker control in edit template.
when i click on edit link in grid it shows all columns in edit mode but when i click on Add new record it throws an error "Specifies cast is not valid"
as i have bound my raddatepicker as below

<

Telerik:GridTemplateColumn DataField="TransDate" Display="False"

 

HeaderText="Trans Date" UniqueName="TransDate">

 

<EditItemTemplate>

 

 

<Telerik:RadDatePicker ID="rdpTransDate" Runat="server"

 

 

Width="116px" SelectedDate='<%# Bind("TransDate") %>'>

 

<DateInput Height="22px" runat="server">

 

</DateInput>

 

 

<Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"

 

 

 

 

ViewSelectorText="x" runat="server">

 

 

 

</Calendar>

 

 

 

</Telerik:RadDatePicker>

 

 

 

</EditItemTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="TransDateLabel" runat="server" Text='<%# Eval("TransDate") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

</Telerik:GridTemplateColumn>

When i press 'Add New Record' it throws an error on line

 

 

 

<Telerik:RadDatePicker ID="rdpTransDate" Runat="server"

 

Width="116px" SelectedDate='<%# Bind("TransDate") %>'>

i believe when i try to add a new record the bind is throwing an error.

Please let me know how to resolve this issue.

Thanks in advance.

Hrushikesh

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jan 2009, 11:03 AM
Hi Hrushikesh,

I would suggest you to use the DbSelectedDate property instead of the SelectedDate property for RadDatePicker.

ASPX:
<Telerik:RadDatePicker ID="rdpTransDate" Runat="server" Width="116px" DbSelectedDate ='<%# Bind("TransDate") %>'

You can also refer the following online demo.
Data binding

Thanks
Shinu.


0
Hrushikesh Mokashi
Top achievements
Rank 1
answered on 27 Jan 2009, 01:53 PM
Thanks Shinu,

It's working with DbSelecteddate.
Tags
Grid
Asked by
Hrushikesh Mokashi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Hrushikesh Mokashi
Top achievements
Rank 1
Share this question
or