DataObjectSource Question

Last post 02-21-2006 9:33 AM by Julián Hidalgo. 1 replies.

Sort Posts:

  • DataObjectSource Question

    02-20-2006, 3:49 PM
    • Member
      35 point Member
    • rick9004
    • Member since 01-16-2006, 3:26 PM
    • Posts 9
    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"


    Does the TypeName need to be qualified somehow?. 

    Any help will be great





  • Re: DataObjectSource Question

    02-21-2006, 9:33 AM
    Hi

    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
Page 1 of 1 (2 items)