System.MissingMemberException未被用户代码处理

时间:2010-04-28 14:34:23

标签: vb.net linq binding telerik

我正在使用此代码:

Dim VehiclesTable1 = dsVehicleList.Tables(0)
Dim VT1 = (From d In VehiclesTable1.AsEnumerable _
          Select VehicleTypeName = d.Item("VehicleTypeName") _
                 , VTypeID = d.Item("VTypeID") _
                 , ImageURL = d.Item("ImageURL") _
                 , DailyRate = d.Item("DailyRate") _
                 , RateID = d.Item("RateID")).Distinct

其linq to dataset

我在THis Rotator上获取数据:

<telerik:RadRotator ID="RadRotatorVehicleType" runat="server" Width="620px" Height="145"
                                                                            ItemWidth="155" ItemHeight="145" ScrollDirection="Left" FrameDuration="1" RotatorType="Buttons">
                                                                            <ItemTemplate>
                                                                                <div style="text-align: center; cursor: pointer; width: 150px">
                                                                                    <asp:Image ID="ImageVehicleType" runat="server" Width="150" ImageUrl='<%# Container.DataItem("ImageURL") %>' />
                                                                                    <asp:Label ID="lblVehicleType" runat="server" Text='<%# Container.DataItem("VehicleTypeName") %>'
                                                                                        Font-Bold="true"></asp:Label>
                                                                                    <br />
                                                                                    <asp:Label ID="lblDailyRate" runat="server" Text='<%# Container.DataItem("DailyRate") %>'
                                                                                        Visible="False"></asp:Label>
                                                                                    <input id="HiddenVehicleTypeID" type="hidden" value='<%# Container.DataItem("VTypeID") %>'
                                                                                        name="HiddenVehicleTypeID" runat="server" />
                                                                                    <input id="HiddenRateID" type="hidden" value='<%# Container.DataItem("RateID") %>'
                                                                                        name="HiddenRateID" runat="server" />
                                                                                </div>
                                                                            </ItemTemplate>
                                                                            <ControlButtons LeftButtonID="img_left" RightButtonID="img_right" />
                                                                        </telerik:RadRotator>

我得到了这个例外:

No default member found for type 'VB$AnonymousType_0(Of Object,Object,Object,Object,Object)'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.MissingMemberException: No default member found for type 'VB$AnonymousType_0(Of Object,Object,Object,Object,Object)'.

我不知道什么事了?

请帮助。

感谢谁试图解决这个问题 但我得到了解决方案:

使用'<%# DataBinder.Eval(Container.DataItem,"ImageURL") %>'

而不是'<%# Container.DataItem("RateID") %>'

谢谢,

1 个答案:

答案 0 :(得分:2)

感谢谁试图解决这个问题,但我得到了解决方案:

使用'<%# DataBinder.Eval(Container.DataItem,"ImageURL") %>'

而不是'<%# Container.DataItem("RateID") %>'

谢谢,