I implemented a SQLdataSource using stored procs without difficulty, but I am stuck on this one.
I have a GridView that is populated from a varing set of SQL selects that change based on the page and need from the originating page. (BTW this is working fine in NET 1.1).
Now with NET2 I'm getting this error:
he type specified in the TypeName property of ObjectDataSource 'resultsData' could not be found.
Code snippets are below....
from my aspx page
<asp:GridView ID="GridView1" runat="server" DataSourceID="resultsData">
...
<asp:ObjectDataSource ID="resultsData" runat="server" SelectMethod="getPropResults" TypeName="test4"
from my code behind page I have the class as "test4" (which is the page name) with a function as
"getPropResults"
"One page class can no longer see other page classes even if they live in the same namespace! This is because they get generated into a dynamic namespace that is not accessible at designtime."
Try something: put a label (Label1) in your web form and add this in the codebehind:
Label1.Text = this.GetType().ToString();
For a webform called "tods.aspx" i get ASP.tods_aspx, but if i set TypeName="ASP.tods_aspx" i get the same error. I tried using a namespace but it's the same.
I think you should create another class and put the method there, not only to fix your problem but because it's a better design.
rick9004
Member
35 Points
9 Posts
DataObjectSource Question
Feb 20, 2006 07:49 PM|LINK
I have a GridView that is populated from a varing set of SQL selects that change based on the page and need from the originating page. (BTW this is working fine in NET 1.1).
Now with NET2 I'm getting this error: he type specified in the TypeName property of ObjectDataSource 'resultsData' could not be found.
Code snippets are below....
from my aspx page
<asp:GridView ID="GridView1" runat="server" DataSourceID="resultsData">
...
<asp:ObjectDataSource ID="resultsData" runat="server" SelectMethod="getPropResults" TypeName="test4"
from my code behind page I have the class as "test4" (which is the page name) with a function as "getPropResults"
Does the TypeName need to be qualified somehow?.
Any help will be great
Julián Hidalgo
Member
130 Points
24 Posts
Re: DataObjectSource Question
Feb 21, 2006 01:33 PM|LINK
I think this is because of the compilation model in ASP.NET 2.0. Take a look at this:
More ASP.NET 2.0 Compilation Model issues - ASPX pages not visible to your app
Rick Strahl says:
"One page class can no longer see other page classes even if they live in the same namespace! This is because they get generated into a dynamic namespace that is not accessible at designtime."
Try something: put a label (Label1) in your web form and add this in the codebehind:
Label1.Text = this.GetType().ToString();
For a webform called "tods.aspx" i get ASP.tods_aspx, but if i set TypeName="ASP.tods_aspx" i get the same error. I tried using a namespace but it's the same.
I think you should create another class and put the method there, not only to fix your problem but because it's a better design.
Greetings.
Julián Hidalgo
<div> </div>