|
Rank: Newbie Groups: Member
Joined: 5/1/2010 Posts: 3
|
I use MasterPage with Menucontrol and contentpages (content place holder) with database connection with object data source connection. Subpages without databaseconnection work great. Applying for subpages with database connection neither XML file nor web.sitemap (with XMLDataSource or SiteMapDataSource) in the same directory work with the menucontrol keeping the connection to fill the menu. Always throws an exception about missing parameters for the object data source (which is not responsible for filling the menu) It should be still filled by the xml or sitemap file via the XMLDataSource or the SiteMapDataSource.
Which option should I set to keep the dataconnection to the xml / sitemap file?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
When you use DataSource control together with menu, the menu and the DataSource control must be inside the same coding unit, that is, either both are in the master page, or both are in the content pages. You can not have one inside master page and the other inside content page.
If you do need to keep your data source inside content page and the menu inside master page, please use XmlFile property instead of DataSourceID property. XmlFile property points to the file name directly, so it does not matter where you set it.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/1/2010 Posts: 3
|
Warm thanks for the quick reply!
But this is exactly my problem. I have the menu control in the Masterpage and tried both possibilities (XMLDataSouce and SiteMapDataSource) also in the Masterpage. I put also the DataConnection in a free line before the content place holder, like in the MSDN described.
And all my ohter data sources are NOT in the Masterpage. They are in the Subpages with the specific task there. It seems, that menu control is linked to data source at a time when the Subpage is included, but the datasource in the Masterpage is not available.
Concerning to your second proposal: Where should I set the XML File Property: In the Property Window in VS 2008 or in the MenuBuilder Popup. I ask, because if I set in the Menubuilder Popup and call the Property Window, (of course after saving) the set is not shown, also not in the Source code of the Master Page.
Hope you can help me, cause it's a bit disappointing. Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
If you have both Menu and your Data Source in your master page, then it WILL work.
If you have Menu in your master page, but your Data Source in your subpages (content pages), then it WILL NOT work.
You can set XmlFile in property window or directly in your .aspx source code.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/1/2010 Posts: 3
|
Sorry for writing again.
This is code snippet now in my Masterpage:
<eo:Menu ID="Menu1" runat="server" Width="360px" ControlSkinID="MSDN" DataSourceID="XmlDataSource1"> </eo:Menu> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/mnuEinzelhaendler.xml"></asp:XmlDataSource>
In the default.aspx, there is Datasource set by following snippet:
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="sArtikelB2PRecherche" TypeName="ArtikelRechercheKomponent" SelectMethod="B2PArtikelRechercheMitPaging"></asp:ObjectDataSource>
And calling the defaultpage occurs the following exception:
Serverfehler in der Anwendung /Shop. ObjectDataSource "ObjectDataSource1" konnte keine nicht generische Methode "B2PArtikelRechercheMitPaging" finden, die keine Parameter hat. Beschreibung: Unbehandelte Ausnahme beim Ausführen der aktuellen Webanforderung. Überprüfen Sie die Stapelüberwachung, um weitere Informationen über diesen Fehler anzuzeigen und festzustellen, wo der Fehler im Code verursacht wurde.
Ausnahmedetails: System.InvalidOperationException: ObjectDataSource "ObjectDataSource1" konnte keine nicht generische Methode "B2PArtikelRechercheMitPaging" finden, die keine Parameter hat.
Sorry it is German version, but it means, that a datarequest with no parameters throws the exception. And it is the menucontrol automatically connecting to the ObjectDataSource1, because, if I delete the Menucontrol, all works fine. And it works also fine, if I call a Subpage with no dataconnection, like e.g. /help/helpmain.aspx. There appears the Menucontrol fine.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, This particular error does not have anything to do with our control. The control might trigger the error message but the problem is somewhere else in your code. Here is another post with similar problem. You might be able to find some clue about what's going wrong there: http://forums.asp.net/t/1158676.aspxThanks!
|
|