Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 17th, 2009, 5:02 PM   #1
drumnbassbboy
Programmer
 
Join Date: Nov 2008
Posts: 55
Rep Power: 6 drumnbassbboy is on a distinguished road
Error: The DataSourceID of 'Repeater1' must be the ID of a control of type IDataSource. A control with ID 'AccessDataSource1' could not be found.

I looked up why I was getting this error. The reason people where saying was because I do not have an AccessDataSource1 control in my .aspx file, which I do. They say it looks for the AccessDataSource1 in the .aspx file, and not the code behind the .aspx file. So this has me a bit puzzled since I do have a AcessDataSource1 in my .aspx code / file. Here is the code from the MasterPage.master file. I have tried a little bit of everything. I even changed the DataSourceID property to DataSource to only get the following error:
"The 'DataSource' property cannot be set declaratively." Mind you, still new to .asp / .aspx. Thanks in advance for the help.

MasterPage.master code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main"><!-- start header -->
<div id="header">
 <div id="logo">
        <h1><a href="#">metamorph_highway</a></h1>
        <h2><a href="http://www.metamorphozis.com/" id="metamorph">Design by Metamorphosis Design</a></h2>
        </div>
        <div id="menu">
                <ul>
                        <li><a href="#">Home</a></li>
                        <li><a href="#">Blogs</a></li>
                        <li><a href="#">Photos</a></li>
                        <li><a href="#">About</a></li>
                        <li><a href="#">Contact</a></li>
                </ul>
        </div> 
<!-- end header -->
</div>
<hr />
<!-- start page -->
<div id="page">
        <!-- start content -->
        <form id="form1" runat="server">
        <div id="content">
                <div class="post">
        <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server" >
            <asp:AccessDataSource ID="AccessDataSource1" runat="server"
                DataFile="~/App_Data/shirts_database.mdb"
                SelectCommand="SELECT DISTINCT Brand FROM shirts_table ORDER BY Brand">
            </asp:AccessDataSource>
            </asp:ContentPlaceHolder>
        </div>
            </div>
        </div>
        <!-- end content -->
        <!-- start sidebar two -->
        <div id="sidebar2" class="sidebar">
                <ul>
                        <li>
                                <h2>Brands</h2>
                                <ul class="back_title">
                                        <li class="top">
                        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource1">
                              <itemtemplate>
                              <a href="shop.aspx?Brand=<%# DataBinder.Eval(Container.DataItem, "Brand") %>">
                              <%# DataBinder.Eval(Container.DataItem, "Brand") %></a>
                              </itemtemplate>

                        </asp:Repeater>
                        <a href="#">Aliquam libero</a></li>
                                        <li><a href="#">Consectetuer elit</a></li>
                                        <li><a href="#">Metus pellentesque</a></li>
                                        <li><a href="#">Suspendisse mauris</a></li>
                                        <li><a href="#">Urnanet molestie semper</a></li>
                                        <li><a href="#">Proin orci porttitor</a></li>
                                </ul>
                        </li>
                        <li>
                                <h2>Archives</h2>
                                <ul class="back_title">
                                        <li class="top"><a href="#">September</a> (23)</li>
                                        <li><a href="#">August</a> (31)</li>
                                        <li><a href="#">July</a> (31)</li>
                                        <li><a href="#">June</a> (30)</li>
                                        <li><a href="#">May</a> (31)</li>
                                </ul>
                        </li>
                        <li>
                                <h2>Lorem ipsum dolor </h2>
                                <ul class="back_title">
                                        <li class="top"><a href="#">Aliquam libero</a></li>
                                        <li><a href="#">Consectetuer elit</a></li>
                                        <li><a href="#">Metus pellentesque</a></li>
                                        <li><a href="#">Suspendisse mauris</a></li>
                                        <li><a href="#">Urnanet molestie semper</a></li>
                                        <li><a href="#">Proin orci porttitor</a></li>
                                </ul>
                        </li>
                </ul>
        </div>
        </form>
        <!-- end sidebar two -->
        <div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<hr />
<!-- start footer -->
<div id="footer">
        <p>Copyright &copy; 2008. <a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a> | <a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a> | <a href="http://jigsaw.w3.org/css-validator/check/referer" title="This page validates as CSS"><abbr title="Cascading Style Sheets">CSS</abbr></a></p>
        <p>Design by <a href="http://www.metamorphozis.com/" title="Free Site Templates">Free Site Templates</a>, coded by <a href="http://www.flashtemplatesdesign.com" title="Free Flash Templates">Free Flash Templates</a>
                </p>
</div>
</div>
<!-- end footer -->
</body>
</html>













shop.aspx code:
<%@ Page MasterPageFile="~/MasterPage.master" Language="C#" AutoEventWireup="true"  CodeFile="shop.aspx.cs" Inherits="_Default2" %>

<asp:Content id="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
    AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="AccessDataSource1">
    <Columns>
        <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
            ReadOnly="True" SortExpression="ID" />
        <asp:BoundField DataField="Brand" HeaderText="Brand" SortExpression="Brand" />
        <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
        <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
        <asp:TemplateField HeaderText="Image" SortExpression="Image">
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Image") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Image") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:HyperLinkField DataNavigateUrlFields="ID"
            DataNavigateUrlFormatString="ShowDetails.aspx?ID={0}" />
    </Columns>
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
    DataFile="~/App_Data/shirts_database.mdb"
    SelectCommand="SELECT * FROM [shirts_table] WHERE ([Brand] = ?) ORDER BY [Type]">
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="Apple" Name="Brand"
            QueryStringField="Brand" Type="String" />
    </SelectParameters>
</asp:AccessDataSource>
&nbsp;
</asp:Content>
drumnbassbboy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show web user control hidden see07 C# 4 Aug 15th, 2010 9:44 PM
Saving image from picture control darkies22 C++ 1 Jan 31st, 2008 5:53 AM
How to add inherited control to toolbox. InfoGeek C# 3 Feb 8th, 2007 9:12 PM
Pointer return type,.. ??? Mack1982 C++ 28 May 26th, 2006 8:02 PM
C programing control of the Serial Port. Light C++ 5 Feb 24th, 2005 2:14 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:41 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC