XmlDataSource in master page

Z

zvickery

Currently I have a project where multiple pages share a master page and
also share a common XmlDataSource. Within the various pages, there are
controls (such as DropDownLists) that I would like to bind to the
common data source using the design-time DataSourceID property.
However, I have been unable to find a way to have a content page's
control successfully reference the XmlDataSource from the master page.


The problem is basically that bound control's DataSourceID expects a
string containing the name of an object within the control's class. Of
course, it is not possible to directly reference controls on the master
page. My question is whether there is indeed a way to share a data
source between pages (ideally using master pages) or if there might be
another workaround possible?

Thank you!
 
K

Keith Patrick

You could create another DataSourceProvider (i.e. GlobalDataSourceResolver)
that can call Page.FindControl(...) and provide the XmlDataSource's data to
the control as if it were its own. There may be a better way, but I've been
immersed in WPF lately, and I KNOW it solves that issue via hierarchical
resource scoping, but it's muddled my ASP.Net memory a bit.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top