Link to home
Start Free TrialLog in
Avatar of AidenA
AidenA

asked on

ASP website: The type specified in the TypeName property of ObjectDataSource ObjectDataSource1 could not be found

Hi,

I'm trying to figure out a question for a microsoft exam... where you have a gridview and an objectdatasource like so

<asp:ObjectDataSource ID="Products" runat="server" SelectMethod="GetData" TypeName="DAL" /> </asp:ObjectDataSource>

Open in new window


So, I created a class called DAL in the codebehind and stuck in a GetData method, but it doesn't work with the error shown in the title of this question. If I move the GetData to the main class of the webform, it still doesn't work with the same error. However, I can get it to work if I set the TypeName in the codebehind (load method) using the following code which I came across on google when trying to solve this

Products.TypeName = Me.GetType().AssemblyQualifiedName

Open in new window


So, that's fine, I can get it to work that way. But, I want to know how to get it to work when the GetData method is in my DAL class... what is the TypeName that I need to specify?

Thanks, Aiden
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

You need to specify the fully qualified name of the class in following

TypeName="DAL"

The format would be projectname.namespace.classname

Example: MyProject.DAL.ProductDAL
Avatar of AidenA
AidenA

ASKER

humm, ok, could be a little tricky as my project name has a . in the middle. I tried to put in

TypeName="70562 on 3.5.DAL"

where I set up '70562 on 3.5' as the name of the project. So, still didn't work not surprisingly. There's no namespace in the aspx page. The page is called 'CTC8.aspx'. So, with that info can you tell me what I should set the TypeName to exactly to get this to work?
SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes you can try that. Try this. Create a variable of this type in code behind and then hover your mouse hover it. What do you see in tooltip?
Avatar of AidenA

ASKER

well i just typed 'Dim D As New DAL' if that's what you mean, but the tooltip will just say 'D {DAL}' then, so not sure what you mean exactly? If you open up the + part of the tooltip to see all the properties there's probably 50 pieces of information from UICulture to whether it is visible or not to choose from. What are you interested in exactly?
Avatar of AidenA

ASKER

anymore on that?
I was just trying to find out the full type of the DAL class. You have to play with this string mate using projectname.namespace.dal or projectname.dal or dal etc.
Avatar of AidenA

ASKER

played around with the string before but didn't get it to work. however, I did just give up on that and stick it into the app_code folder with the namespace DALClass so that the below worked ok.

<asp:ObjectDataSource ID="Products" runat="server" SelectMethod="GetData" TypeName="DALClass.DAL"></asp:ObjectDataSource>

Open in new window


thanks, Aiden
Avatar of AidenA

ASKER

x