ObjectDataSource DataObjectTypeName Help. Pass object as parameter
- by Kettenbach
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