Last post Oct 27, 2012 01:05 PM by Shallb
Oct 26, 2012 05:47 AM|Shallb|LINK
I have a masterpage which has an AccessDataSource control on it., which I reference on the codebehind page. The purpose of the AccessDataSource is to have a textbox on all pages into which the user can save a memo. (It needs to be availablemon all pages
on the website)
When the masterpage is combined with a content page, though, the AccessDataSource is not recognised.
Can anyone suggest a way of having a dataentry box on the masterpage?
Oct 26, 2012 06:53 AM|oned_gk|LINK
Oct 26, 2012 07:12 AM|Shallb|LINK
I know you can have code behind on the masterpage. The problem is that the codebehind doesn't recognise the AccessDataSource when it is combined with a Content page.
Oct 27, 2012 04:35 AM|Decker Dong - MSFT|LINK
I don't suggest you putting any DataSource Control to master page. For if you do this, a data presentation control such as "GridView", "DetailsView" or "FormView" will not recognize where your data source is.
So you should put them together.——That's a best method;）
Also you can have a try something like
Page.MasterPage.FindControl("AccessDataSourceID") as AccessDataSource and do something binding manually, but that's too complicated and easy to cause problems.
Oct 27, 2012 01:05 PM|Shallb|LINK
Followed the second part of your advice (i.e used findcontrol), and debugged the problem.
For anyone in the same situation, I found that the AccessDataControl was housed within a parent control. So once I have found the reference to teh parent control, I was able to use the parentcontrol.findcontrol to find the reference to the AccessDataControl
which I was then able to bind to without any further problems.
Thanks for your help.