473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Access Masterpage SQLDatasource

I have a MasterPage with a SqlDatSource named "myDS".
In a content page placed inside a ContentPlaceHolder I have a GridView that
I need to connect to myDS.

The problem is that "myDS" is not listed in the GridView's "Choose Data
Source" list. If I force it to "myDS", I can access the data in runtime
(i.e. the page runs OK), but the designer doesn't show the columns, data,
etc., to design the GridView.

Any ideas?
Thanks!
Aug 21 '08 #1
2 1339
I don't know a simple solution. If I had to do this, I'd expose a property
in the master page that returns the data source. You could then reference
the Master property and type cast it to your master page in your content
page's Load event and set the GridView's data source.

Beyond that, it's hard for me to think of a case where it makes sense to put
a datasource in the master page unless the data is also being displayed from
the master page. FWIW, I wouldn't think twice about duplicating a data
source on different pages if I needed the same data on both pages.

Don't know if that's any help though.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Gaspar" <no*****@nospamplease.comwrote in message
news:eQ**************@TK2MSFTNGP03.phx.gbl...
>I have a MasterPage with a SqlDatSource named "myDS".
In a content page placed inside a ContentPlaceHolder I have a GridView
that I need to connect to myDS.

The problem is that "myDS" is not listed in the GridView's "Choose Data
Source" list. If I force it to "myDS", I can access the data in runtime
(i.e. the page runs OK), but the designer doesn't show the columns, data,
etc., to design the GridView.

Any ideas?
Thanks!
Aug 21 '08 #2
Why not cache your data?
Hope this will help.

MatrixGoh

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:eI**************@TK2MSFTNGP06.phx.gbl...
>I don't know a simple solution. If I had to do this, I'd expose a property
in the master page that returns the data source. You could then reference
the Master property and type cast it to your master page in your content
page's Load event and set the GridView's data source.

Beyond that, it's hard for me to think of a case where it makes sense to
put a datasource in the master page unless the data is also being
displayed from the master page. FWIW, I wouldn't think twice about
duplicating a data source on different pages if I needed the same data on
both pages.

Don't know if that's any help though.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Gaspar" <no*****@nospamplease.comwrote in message
news:eQ**************@TK2MSFTNGP03.phx.gbl...
>>I have a MasterPage with a SqlDatSource named "myDS".
In a content page placed inside a ContentPlaceHolder I have a GridView
that I need to connect to myDS.

The problem is that "myDS" is not listed in the GridView's "Choose Data
Source" list. If I force it to "myDS", I can access the data in runtime
(i.e. the page runs OK), but the designer doesn't show the columns, data,
etc., to design the GridView.

Any ideas?
Thanks!
Aug 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dawg1998 | last post by:
I am trying to access a label located in a MasterPage from a class located in my application's App_Code folder. The problem seems to be that the class cannot communicate with the MasterPage due to...
5
by: RedHair | last post by:
I have a ASP.NET 2.0 web page which inherits a customized base page class and have a master page, their relation is as below Customized base page class --> web page --> master page How to...
3
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing,...
4
by: cevans | last post by:
Is there a way to load a MasterPage programmatically? Not switch a page's masterpage but to create a MasterPage object that holds a given masterpage. So I know I can do: MasterPage master =...
3
by: RAR in WA | last post by:
I'm moving to .Net framework 2.0 from Visual Studio 2002/3 with more time on desktop apps than ASP.Net, although I have done a small amount in ASP.Net. Is best practice for ASP.Net now to use the...
0
by: danielhamd | last post by:
I am converting a website that uses an Access Database to SQL Server. On one particular SqlDataSource I am having a lot of trouble. Here is the original: <asp:SqlDataSource ID="SqlDataSource1"...
1
by: supervictor | last post by:
Hello All, I'm working with VWD 2005 and VB and I'm facing the following problem: a web form works perfect by itself, but when I put it inside a masterpage, then the SqlDataSource2.Insert() which...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
4
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.