CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!
Free 3 Months



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 9/28/2006 5:46:51 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 8 Views: 21 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
9 Items, 1 Pages 1 |< << Go >> >|
alockrem
Asp.Net User
Setting a property value9/28/2006 5:46:51 PM

0/0

I have developed a site that uses master pages for its structure.  I am forced to use a specific header and footer and I have multiple master pages so I decided to store the header and footer as custom controls.

A web page (~/default.aspx) uses a master page (~/masterPages/home.master).  The master page uses the custom control (~/intStd/Header.ascx).  The custom control has a public property (pgTitle() As String) that I can set from the master page.

 My question - How do I set the value of pgTitle from the Default.aspx page?

Thank you for any help.

jcasp
Asp.Net User
Re: Setting a property value9/28/2006 10:41:38 PM

0/0

See if the following link helps.  If not, try search for "accessing control in master page" for past topics.

http://forums.asp.net/thread/1370211.aspx 

 

alockrem
Asp.Net User
Re: Setting a property value9/29/2006 12:03:41 PM

0/0

Thank you.  The post you referenced does discuss the exact problem I'm having.... but my site still is not working.  I'm sure it's a syntax problem on my part, but I don't know what I've done wrong.  Below is the code I'm using and the error I'm getting.

~/MasterPages/Home.Master

...
<%@ Register
    TagPrefix="IntStd"
    TagName="Header"
    Src="~/_intStdTmp/Header.ascx" %>
....
<script language="VB" runat="server">

    Public Sub SetPageTitle(ByVal sTxt As String)
        intStd_Header.pgTitle = sTxt
    End Sub

</script>
....
    <intStd:Header
        ID="intStd_Header"
        runat="Server"
        pgTitle="123" />
....
~/Default.aspx
<%@ Page
    Language="VB"
    MasterPageFile="~/MasterPages/Home.master"
    Title="Homepage"
    CodeFile="Default.aspx.vb"
    Inherits="_Default" %>

<%@ MasterType
    VirtualPath="~/MasterPages/Home.master" %>
 
~/Default.aspx.vb
...
Page.Master.SetPageTitle("test111")
....
 
Error:
Compiler Error Message: BC30456: 'SetPageTitle' is not a member of 'System.Web.UI.MasterPage'.
 
Thank you very much for all of your help.
Bishoy Labib
Asp.Net User
Re: Setting a property value9/30/2006 12:09:50 AM

0/0

you need to cast the Page.Master object to your master page class before calling SetPageTitle

This should work in C#:

((Home)Page.Master).SetPageTitle("test111")  


About VB I'm not sure but you can try this:

Home masterpage=Page.Master
masterpage.SetPageTitle("test111")


Bishoy Labib
Senior Solution Developer
LINKdotNET, Egypt
alockrem
Asp.Net User
Re: Setting a property value10/2/2006 12:37:42 PM

0/0

Thank you for your assistance, but that did not fix the problem.  My understanding is the @MasterType line makes it so you don't have to cast the Master Page, but I did anyway to see if that would fix the problem.  I am still getting an error.

The new code:

Dim mpHome As MasterPage
mpHome = Page.Master
mpHome.SetPageTitle("Test111")
The error I get is:
'SetPageTitle' is not a member of 'System.Web.UI.MasterPage'.
Thank you for any help.
LudovicoVan
Asp.Net User
Re: Setting a property value10/2/2006 1:37:56 PM

0/0

alockrem:
Dim mpHome As MasterPage
mpHome = Page.Master
mpHome.SetPageTitle("Test111")
The error I get is:
'SetPageTitle' is not a member of 'System.Web.UI.MasterPage'.

Should be: Dim mpHome As Home. With your code above, mpHome is still a generic MasterPage type...

Hope this helps. -LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
alockrem
Asp.Net User
Re: Setting a property value10/2/2006 1:53:58 PM

0/0

That is exactly what I just found out.  I was unable to get this to work when the MasterPage used inline code.  I had to use a codeFile and reference the classname.  I'm sure there is another way to do it, but for now it works.  For anyone having a similar problem - below is the code I ended up using.

Dim mpHome As MasterPages_Home
mpHome = CType(Page.Master, MasterPage)
mpHome.PageTitle = "123"
The ~/MasterPages/Home.master page inherits MasterPages_Home from it's codeFile.  It has the following property.
    Public Property PageTitle() As String
        Get
            Return intStd_Header.pgTitle
        End Get
        Set(ByVal value As String)
            intStd_Header.pgTitle = value
        End Set
    End Property
Thank you everyone for your help!
LudovicoVan
Asp.Net User
Re: Setting a property value10/2/2006 2:01:56 PM

0/0

Get rid of the CType (the cast) there. You are casting back to a generic MasterPage, and while your specific code above works, it is logically incorrect and might fail if you make any changes around...

-LV


Julio P. Di Egidio
Software Analyst / Programmer
http://julio.diegidio.name

(Peace X Love] = [++1)
alockrem
Asp.Net User
Re: Setting a property value10/2/2006 3:30:00 PM

0/0

I took that out and you're right, it works.

 Thanks again for all of your help.

9 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Programming Visual Basic .NET Authors: Jesse Liberty, Dave Grundgeiger, Pages: 541, Published: 2003
JavaScript: The Definitive Guide Authors: David Flanagan, Pages: 916, Published: 2002
Java in a Nutshell Authors: David Flanagan, Pages: 1254, Published: 2005
Dynamic HTML: The Definitive Reference Authors: Danny Goodman, Safari Tech Books Online, Pages: 1401, Published: 2002
ECSCW '99: Proceedings of the Sixth European Conference on Computer Supported Cooperative Work, 12-16 September 1999, Copenhagen, Denmark Authors: Susanne Bødker, Morten Kyng, Kjeld Schmidt, Pages: 451, Published: 1999
Webmaster in a Nutshell: A Desktop Quick Reference Authors: Stephen Spainhour, Robert Eckstein, Pages: 561, Published: 2003
HTML and XHTML: The Definitive Guide Authors: Chuck Musciano, Bill Kennedy, Pages: 645, Published: 2002
Computers and Education: E-learning from Theory to Practice Authors: Baltasar Fernández Manjón, Juan Manuel Sanchez Perez, Juan Antonio Gòmez-Pulido, Miguel Angel Vega-Rodríguez, José Bravo-Rodríguez, Pages: 241, Published: 2007
Programming .NET Security Authors: Adam Freeman, Allen Jones, Pages: 693, Published: -1
Modern Real Estate Practice Authors: Fillmore W. Galaty, Wellington J. Allaway, Robert C. Kyle, Pages: 530, Published: 2002

Web:
Setting Default Property Values :: Handle Graphics Objects (MATLAB®) How MATLAB determines what values to use for a given object's properties and how to define default values.
Setting Public Property Values on the Command Line (Windows) To set a public property to a literal string value, include the string between quotation marks.
(struts/JSTL) Setting bean property value with jstl choose ... I have some JSTL in a JSP that creates a statement on ... I need to find a way to save that entire output string to another ... action form property. ...
Setting default property value for user control - .NET VB Setting default property value for user control. Get answers to your questions in our .NET VB forum.
Setting a property value as default - The Omni Group Forums Setting a property value as default OmniGraffle General. ... So, all you need to do is save a Template with that setting to "flat" as your default, ...
(struts/JSTL) Setting bean property value with jstl choose ... (struts/JSTL) Setting bean property value with jstl choose compound results. Options ... have no idea how to concat strings into a property using JSTL ...
RE: html:checkbox tag not setting its property value in Formbean RE: html:checkbox tag not setting its property value in Formbean. Maturo, Larry Mon, 11 Mar 2002 08:25:50 -0800. Hi Krishnan, If you are using a nightly ...
Setting a property value - ASP.NET Forums Setting a property value. Last post 10-02-2006 11:30 AM by alockrem. 8 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
Nabble - Maven - Users - Setting a property value from an Ant task Setting a property value from an Ant task. Hi All. I have the following situation: I have two maven properties that should take a value or ...
House prices - setting the value How to set a price on a home and factors that determine the value of a house. ... be worth is one of the first steps in beginning to market the property. ...

Videos:
Priced below 2007 property tax appraisal-Three Bedroom on .69 Acres in country setting of the mountains of east tennessee Come to the country and enjoy the mountain views from this very nice three bedroom two bath with large front and back fenced in yards. Lots of room f...
Great Value in Today's Market http://www.tourfactory.com/s447452/r_www.youtube.com Set on two acres, this brand new home begins as something different from the average HPP home....
www.thesolarvillage.com - Passive Solar Tell others to see http://www.thesolarvillage.com/ . Andreas Delleske is a member of a private group that built a "passive house" that uses only 1.5 ...
Overland Tax Hearing and Special Council Meeting Aug 27th 2007 On August 27th, 2007 the Overland City Council met to set the property tax rates for the year. Added to this meeting was a Special Council session ...
FOR SALE THE ULTIMATE COMPLETE HOME / CLUB DJ SET UP!!! FOR SALE THE ULTIMATE COMPLETE HOME / CLUB DJ SET UP!!! EBAY ITEM NOW FOR SALE COPY BELOW LINK http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&ite...
Chandler Arizona Home for Sale Custom Chandler Home w/Casita Value Priced $100K Below Market 902 E COCONINO PLACE Chandler, AZ 85249 Property Information & Specifications As...
Greg Brophy on property tax revenue Senator Greg Brophy talks about an amendment he ran to set aside the revenue generated by the property tax increase incase the State of Colorado loss...
Urban Property Rights in Peru - pt. 1 of 2 Since the 1940s rural-to-urban migration has radically altered the structure of Peruvian cities. Migrants from rural areas were largely excluded by ...
1999-2005 BU State Quarter Mania 105-Coin Set - AutoShip - Item: 644-867 State Quarter Mania is the best way to describe this comprehensive coin package that features 105 of our nation's most popular commemorative coins....
Sky NEWS - Jonathan Davis interview 16/09/07 Jonathan Davis is at the forefront of the website http://www.HousePriceCRash.co.uk and here in an interview on Sky News TV he voices his opinion on t...




Search This Site:










create a suggestion feature

another menu/sitemap question

back button

menu control and sitemap

dynamic masterpages and themes

nested master pages blues

error: content controls are allowed only in content page that references a master page.

custom attribute to sitemap datasource

master pages and vs.net 2003

master page - content place holder top margin

master page and java script

dynamically create sitemapproviders

themes again :)

menu control appearance

what's the wrong with master page and postback ?

tree view, saving state & using node links as expand and collapse

sitemappath and self joined table

updating a pic on a content?

searching treeview

programaticaly expand a tree

masterpage - contentplaceholder and tables

how to access the content page control events in masterpage' s javascipt

linking menu controls

how can i access a treeview node from other event handlers?

addnode not working when url is empty

sitemapnode problem

printing in master pages

treenode text color

asp.net menu

.net 2.0 menu control problem

  Privacy | Contact Us
All Times Are GMT