Wrox Programmer Forums
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 3rd, 2008, 10:14 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default ObjectDataSource in UserControl

I have some code that is going to be used in several places in my project, and it is an ideal candidate for a UserControl. It is a search/results form. It uses an ObjectDataSource to get the results from the search criteria.

I set the properties of the ODS at runtime, in the Page_Load of the control and in the Page_Load of the host page. When the host page loads up, there are no errors, but when I run the search, I get the error, "ObjectDataSource 'odsSelector' could not find a non-generic method 'GetUnapprovedCases' that has parameters: UserCenterID, SearchType, UserCenterID1, SearchType1.".

UserCenterID1 and SearchType1 do not exist. What gives? I have a feeling I am close to the answer here, but it eludes me. Thanks in advance for your comments.

 The Page_Load of the control looks like this:

Private Shared SearchText As String = ""

Private Shared ClassName As String

Private Shared MethodName As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
With odsSelector

.SelectParameters.Add("UserCenterID", TypeCode.Int32, Session("UserCenterID")) 

.SelectParameters.Add("SearchType", TypeCode.String, Trim(txtSearchTypeValue.Text)) 

.SelectParameters("SearchType").DefaultValue = "LastName"

.TypeName = ClassName 
.SelectMethod = MethodName

End With

End Sub
The values for ClassName and MethodName are passed in the Host page's load event.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with ObjectDataSource miguel.ossa ASP.NET 2.0 Professional 1 February 9th, 2008 08:37 AM
ObjectDataSource Best Practices? TKelley4591 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 July 20th, 2007 02:39 PM
CH5 ObjectDataSource nabeelalkaff BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 8th, 2007 01:19 PM
Problem with ObjectDataSource... veeruu ASP.NET 2.0 Professional 0 March 2nd, 2007 07:45 AM
What does ObjectDataSource.Update do? Aaron Edwards ASP.NET 2.0 Basics 1 November 27th, 2006 05:40 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.