The DataSourceID of ‘gridID’ must be the ID of a control of type IDataSource. A control with ID ‘objectcontainerdatasourceID’ could not be found.

The DataSourceID of ‘gridID’ must be the ID of a control of type IDataSource. A control with ID ‘objectcontainerdatasourceID’ could not be found.

Scenario:

I have One grid which is binded with objectcontainerdatasource. But when i try to run a page it shows me error as shown above.. i can’t figure it out why it working like so…but my colleague had found its solution.. Actually i have kept Grid and Objectconatinerdatasource within a Master page and it is underneath of LetZonePart..which is main problem.. when you run a page then it will hide all other controls which will not going to show on page e.g. ObjectContainerdatasoruce: so my old code which is not working is here:

<asp:Content ID=”Content1″ ContentPlaceHolderID=”LeftZoneParts” runat=”Server”>
<asp:GridView ID=”Mygview” runat=”server” AutoGenerateColumns=”false” Width=”950px” DataSourceID=”Myobjcdatasrc” >
<Columns>
//My Cols
</Columns>
</asp:GridView>
<pp:ObjectContainerDataSource runat=”server” ID=”Myobjcdatasrc” DataObjectTypeName=”Employee” />
<asp:content>

Solution:

Just put your grid and all stuff in ContentPlaceHolder rather than LeftZonePart. That’s it..working one is here…

<asp:Content ID=”Content1″ ContentPlaceHolderID=”ContentPlaceHolder1″ runat=”Server”>
<asp:GridView ID=”Mygview” runat=”server” AutoGenerateColumns=”false” Width=”950px” DataSourceID=”Myobjcdatasrc” >
<Columns>
//My Cols
</Columns>
</asp:GridView>
<pp:ObjectContainerDataSource runat=”server” ID=”Myobjcdatasrc” DataObjectTypeName=”Employee” />
<asp:content>

Happy Coding!!!

About these ads

Tags:

About kiranpatils

As a passionate programmer I am enjoying in this field for more than 6 years, currently leading a development team. This team is responsible for keeping high up-time and low response time of application, debugging critical performance related issues, analyzing live issue as a high priority, application version upgrade and above all developing new features on top of Sitecore. Many a times I get involved in client conversations as well for new requirement or wherever some technical or functional guidance is required. Other than that, I do enjoy working in a team and building the overall strength of team by effective knowledge sharing and guidance. Spending free time with family and friends, listening music, reading books, traveling and exploring the nature, keeps me recharged! Recognized as a Microsoft Certified Technology Specialist - Web and Windows, and a Microsoft Certified Professional Developer - Web. Enjoys helping others for solving technical issues. Writes regular posts at : https://kiranpatils.wordpress.com/ and http://sitecorebasics.wordpress.com/

5 responses to “The DataSourceID of ‘gridID’ must be the ID of a control of type IDataSource. A control with ID ‘objectcontainerdatasourceID’ could not be found.”

  1. ranjithkumar says :

    Hi… I’m also getting same error like you. But your post is not helpful for me. I cannot understand your explanation and your code snippets also seems same except with different id’s for ContentPlaceHolderID . Can you please post detail information about how you resolved issue.

  2. Burkhardt and Larson says :

    I almost never leave comments, but i did some searching and wound up here The DataSourceID of ‘gridID’ must be the ID of a control of type IDataSource.

    A control with ID ‘objectcontainerdatasourceID’ could not
    be found. « A Place for C Sharpers/.Netters. And I
    do have 2 questions for you if it’s allright. Could it be only me or does it look like some of the responses look like they are left by brain dead people? :-P And, if you are writing at other social sites, I’d like
    to keep up with anything fresh you have to post. Could you make a list of all of all your public pages like your
    Facebook page, twitter feed, or linkedin profile?

    • kiranpatils says :

      Thank you for the appreciation, it matters a lot! Nothing like that, It’s always a learning and sharing!

      Keep visiting! Keep reading! Keep sharing!

      Sincerely.
      Kiran Patil

  3. Order Trimextrin says :

    Hello! Someone in my Myspace group shared this website with us so I came to give it a look.

    I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers!

    Superb blog and amazing design.

  4. put cccam prio says :

    Hello, I check your blogs like every week. Your humoristic
    style is awesome, keep up the good work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 250 other followers

%d bloggers like this: