I'm using RadDropdownlist in Radgrid, "SelectedValue " or "Databinding" cause DataRowView . I don't know why?
Here is my code:
datasource part
<
asp:SqlDataSource
ID
=
"landmarketclasssqldatasource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:myAsystemstring %>"
SelectCommand="SELECT [PK_LandMarketClass],[LandMarketClass] FROM [Ref_LandMarketClass]">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"mysqldatasource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:myAsystemstring %>"
SelectCommand="select a.PK_land, a.pk_bookID, a.landblockname, a.capacityrate, a.landblockarea, b.landmarketclass, a.pk_period from LD_Landblock a left join Ref_LandMarketClass b on a.PK_landmarketclass=b.PK_landmarketclass where pk_bookID=@pk_bookID"
InsertCommand ="insert into ld_landblock (PK_bookID ,landblockname,capacityrate,landblockarea, pk_landmarketclass, pk_period,pk_userIDlasteditor) values(@pk_bookid, @landblockname,@capacityrate,@landblockarea,@pk_landmarketclass,@pk_period,@pk_userIDlasteditor)"
UpdateCommand ="update ld_landblock set landblockname=@landblockname, capacityrate=@capacityrate, pk_useridlasteditor=@pk_useridlasteditor,landblockarea=@landblockarea, pk_landmarketclass=@pk_landmarketclass where pk_land=@pk_land"
DeleteCommand="delete from ld_landblock where pk_land=@pk_land"
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"HFPK_BookID"
Name
=
"pk_bookID"
PropertyName
=
"Value"
/>
</
SelectParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"LandBlockName"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CapacityRate"
Type
=
"Decimal"
></
asp:Parameter
>
<
asp:ControlParameter
ControlID
=
"HFPK_BookID"
Type
=
"Int32"
Name
=
"pk_bookID"
PropertyName
=
"Value"
/>
<
asp:ControlParameter
ControlID
=
"HFUserID"
Type
=
"Int32"
Name
=
"pk_userIDlasteditor"
PropertyName
=
"Value"
/>
<
asp:ControlParameter
ControlID
=
"HFPK_Period"
Type
=
"Int32"
Name
=
"pk_period"
PropertyName
=
"Value"
/>
<
asp:Parameter
Name
=
"landblockarea"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"pk_landmarketclass"
Type
=
"Int32"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"PK_land"
Type
=
"Object"
/>
<
asp:Parameter
Name
=
"LandBlockName"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"CapacityRate"
Type
=
"Decimal"
></
asp:Parameter
>
<
asp:ControlParameter
ControlID
=
"HFUserID"
Type
=
"Int32"
Name
=
"pk_userIDlasteditor"
PropertyName
=
"Value"
/>
<
asp:Parameter
Name
=
"landblockarea"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"pk_landmarketclass"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"PK_land"
Type
=
"Object"
></
asp:Parameter
>
</
DeleteParameters
>
</
asp:SqlDataSource
>
and raddropdownlist in radgrid
method 1
<
telerik:GridDropDownColumn
HeaderText
=
"class"
UniqueName
=
"pk_landmarketclass"
DataSourceID
=
"landmarketclasssqldatasource"
ListTextField
=
"landmarketclass"
ListValueField
=
"pk_landmarketclass"
DataField
=
"pk_landmarketclass"
>
</
telerik:GridDropDownColumn
>
method 2
<
telerik:RadDropDownList
ID
=
"RDDLlandmarketclass"
runat
=
"server"
DataSourceID
=
"landmarketclasssqldatasource"
DataTextField
=
"landmarketclass"
DataValueField
=
"pk_landmarketclass"
SelectedValue='<%# Bind("PK_landmarketclass") %>' >
</
telerik:RadDropDownList
>
neither of methods works. all of them cause datarowview error.
my reference: http://demos.telerik.com/aspnet-ajax/dropdownlist/examples/applicationscenarios/dropdownlistingird/defaultcs.aspx
http://www.telerik.com/forums/bind-dropdown-selected-value-to-a-data-source
Thanks in advance