ObjectDataSource error

M

mrajanikrishna

Hi friends,

I have placed a GridView and its DataSourceId is
ObjectDaatSource1.

<asp:ObjectDataSource id="ObjectDataSource1" runat=server
TypeName="AuthorsDb" SelectMethod="GetStates"/>

My page name is dataaccess2.aspx

Cant I declare a type (AuthorsDb) in codebehind file or cant I
directly give the dataaccess2 class as the TypeName for
ObjectDataSource?

When I write the code(AuthorsDb) at the end of public partial class
dataaccess2 : System.Web.UI.Page

{

}

Its compiling well but has rntime error "Type specified in the
TypeName property of objectdatasource "ObjectDataSource1" not found.

When I create a separate class "AuthorsDb.cs" and run, its executing.

Cant I use codebehind for the ObjectDataSource?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top