ObjectDataSource DataObjectTypeName Help. Pass object as parameter

Posted by Kettenbach on Stack Overflow See other posts from Stack Overflow or by Kettenbach
Published on 2009-07-15T05:02:39Z Indexed on 2010/05/22 21:20 UTC
Read the original article Hit count: 359

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net