G
Guest
Hi guys
Just a general query regarding using the AccessDataSource within a website
which uses a MasterPage.
The layout of my content page is as follows...
<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" Runat="Server">
<h1><asp:Label runat="server" Text='<%# Eval("StoryTitle") %>"
ID="lblHeading" />
</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphSidebar" Runat="Server">
<!-- more Evals and content -->
<!-- data access -->
<asp:AccessDataSource ID="adsStory" runat="server"
DataFile="~/App_Data/data.mdb"
SelectCommand="SELECT [StoryTitle] FROM [Stories]
WHERE ([StoryID] = ?)">
<SelectParameters>
<asp:QueryStringParameter Type="Int32"
QueryStringField="id" />
</SelectParameters>
</asp:AccessDataSource>
</asp:Content>
The problem is that in order to make the databinding work in Content1, I
actually have to create a seperate AccessDataSource object WITHIN Content1.
If I put the AccessDataSource outside the content(s), VS won't compile it.
The only way round is, as I say, to either create 2 datasources (one for
each content), which surely will impact on the level of database activity,
speed, etc? Or alternatively, to use code-behind databinding.
The obvious answer is "just use code-behind") but I feel like I'm missing
something... surely there is a way to have multiple content areas on a
MasterPage child and only use 1 datasource across both? (while still being
able to do it without code-behind) ..?
Thanks
Dan
Just a general query regarding using the AccessDataSource within a website
which uses a MasterPage.
The layout of my content page is as follows...
<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" Runat="Server">
<h1><asp:Label runat="server" Text='<%# Eval("StoryTitle") %>"
ID="lblHeading" />
</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphSidebar" Runat="Server">
<!-- more Evals and content -->
<!-- data access -->
<asp:AccessDataSource ID="adsStory" runat="server"
DataFile="~/App_Data/data.mdb"
SelectCommand="SELECT [StoryTitle] FROM [Stories]
WHERE ([StoryID] = ?)">
<SelectParameters>
<asp:QueryStringParameter Type="Int32"
QueryStringField="id" />
</SelectParameters>
</asp:AccessDataSource>
</asp:Content>
The problem is that in order to make the databinding work in Content1, I
actually have to create a seperate AccessDataSource object WITHIN Content1.
If I put the AccessDataSource outside the content(s), VS won't compile it.
The only way round is, as I say, to either create 2 datasources (one for
each content), which surely will impact on the level of database activity,
speed, etc? Or alternatively, to use code-behind databinding.
The obvious answer is "just use code-behind") but I feel like I'm missing
something... surely there is a way to have multiple content areas on a
MasterPage child and only use 1 datasource across both? (while still being
able to do it without code-behind) ..?
Thanks
Dan