I have a RadGrid...
Im using the EditFormTemplate to show a table with various controls. some are simple text boxes others (dropdownlists) are bound to a different datasource to get predefined values form the DB.
Everything is working well, I can display a list of records, page, sort, filter, and edit a single record without a problem.
however, when I try to insert a new record i get a YSOD sayiing the selected value is not in the datasource
. in the case of the ddl the initial selected value would be "" and since that value does not exist in the datasource I can see why the error is thrown. I have mitigated this by adding in a bank listitem and appending databound items but this seems like a workaround and not a solution.
In the case of a telerik:RadDateInput...
im setting the selected date to a value from the radgrids datasource, again all of the features work until i try to insert a new record. Because the control is bound the selecteddate will be "" which cant be converted to a real date so i get a {"Specified cast is not valid."} exception.
How can this situation avoided on the insert and still have data bound controls on the edit/update
i was thinking of some kind of conditional binding expression but im not familiar with how to do that
Thanks, Scott
<
telerik:RadGrid
ID
=
"RadGrid_1"
runat
=
"server"
DataSourceID
=
"EntityDataSource_1"
CellSpacing
=
"0"
GridLines
=
"None"
AllowPaging
=
"True"
AllowSorting
=
"True"
AllowFilteringByColumn
=
"True"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
Width
=
"970px"
>
Im using the EditFormTemplate to show a table with various controls. some are simple text boxes others (dropdownlists) are bound to a different datasource to get predefined values form the DB.
Everything is working well, I can display a list of records, page, sort, filter, and edit a single record without a problem.
however, when I try to insert a new record i get a YSOD sayiing the selected value is not in the datasource
. in the case of the ddl the initial selected value would be "" and since that value does not exist in the datasource I can see why the error is thrown. I have mitigated this by adding in a bank listitem and appending databound items but this seems like a workaround and not a solution.
In the case of a telerik:RadDateInput...
<
telerik:RadDateInput
ID
=
"RadDateInput44"
runat
=
"server"
SelectedDate='<%# Bind("effectivedate")%>' />
im setting the selected date to a value from the radgrids datasource, again all of the features work until i try to insert a new record. Because the control is bound the selecteddate will be "" which cant be converted to a real date so i get a {"Specified cast is not valid."} exception.
How can this situation avoided on the insert and still have data bound controls on the edit/update
i was thinking of some kind of conditional binding expression but im not familiar with how to do that
Thanks, Scott