对象数据源数据对象类型名称帮助。 将对象作为参数传递
我有一个分部类(主类是 LinqToSql 生成的类)
<DataObject(True)> _
Partial Public Class MBI_Contract
<DataObjectMethod(DataObjectMethodType.Select, True)> _
Public Shared Function GetCancelableContracts(ByVal dealer As Dealer) As List(Of MBI_Contract)
Return Utilities.GetCancelableContractsForDealer(dealer)
End Function
End Class
这是它调用的方法
Public Function GetCancelableContractsForDealer(ByVal dealer As Dealer) As List(Of MBI_Contract)
Dim db As TestDataContext = TestDataContext.Create()
Return (From mbi As MBI_Contract In db.MBI_Contracts _
Where mbi.MBI_DealerNumber = dealer.DealerNumber _
AndAlso mbi.MBI_PaidFor = True _
AndAlso mbi.MBI_Deleted = False).ToList()
End Function
我想使用 ObjectDataSource 来驱动 DropDownList。
<asp:ObjectDataSource ID="contractOds" runat="server"
TypeName="MBI_Contract"
SelectMethod="GetCancelableContracts"
DataObjectTypeName="Dealer">
</asp:ObjectDataSource>
我的 aspx 页面有一个在 BasePage 中设置的 Dealer 属性。 我的问题是如何将此属性(对象)传递给 ObjectDataSource,以便可以在我的 select 方法中对其进行评估。 有谁知道我该怎么做? 或者我完全以错误的方式做这件事?
感谢您的任何建议, 干杯, 〜ck在圣地亚哥
I have a partial class (the main class is a LinqToSql generated class)
<DataObject(True)> _
Partial Public Class MBI_Contract
<DataObjectMethod(DataObjectMethodType.Select, True)> _
Public Shared Function GetCancelableContracts(ByVal dealer As Dealer) As List(Of MBI_Contract)
Return Utilities.GetCancelableContractsForDealer(dealer)
End Function
End Class
Here is the method it's calling
Public Function GetCancelableContractsForDealer(ByVal dealer As Dealer) As List(Of MBI_Contract)
Dim db As TestDataContext = TestDataContext.Create()
Return (From mbi As MBI_Contract In db.MBI_Contracts _
Where mbi.MBI_DealerNumber = dealer.DealerNumber _
AndAlso mbi.MBI_PaidFor = True _
AndAlso mbi.MBI_Deleted = False).ToList()
End Function
I want to use the ObjectDataSource to drive a DropDownList.
<asp:ObjectDataSource ID="contractOds" runat="server"
TypeName="MBI_Contract"
SelectMethod="GetCancelableContracts"
DataObjectTypeName="Dealer">
</asp:ObjectDataSource>
My aspx page has a Dealer property that is set in a BasePage. My question is how can I pass this property(object) to the ObjectDataSource, so it can be evaluated in my select method. Does anyone know how I can do this? Or am I totally doing this the wrong way?
Thanks for any Advice,
Cheers,
~ck in San Diego
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎有效。
This seems to work.