CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 7/23/2007 2:09:36 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 31 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
zoltac007
Asp.Net User
Help with passing MasterPage variables7/23/2007 2:09:36 AM

0/0

I have a master page with two drop down lists.  After the user makes the two selections, State and City, they select one of two links taking them to one of two pages that use this master page.  Is there a way to pass and display both selected values to the content page in its page load?   

I have delcared them Public in the master page as shown below:

public string StateAbbrev
    {   get
      {   return DropDownList1.SelectedValue; }
    }
public string CityName
    {   get
      {   return DropDownList2.SelectedValue; }
    }

How do I call these two master page string values in the content page? I tried to understand the info on Content.Handler but I am lost.  I know the below is way off but it is my starting point:

ResultsOne.apsx Page Load:

protected void Page_Load(object sender, EventArgs e)

TextBox7.Text = Convert.ToString(CityName);
TextBox8.Text = Convert.ToString(StateAbbrev);

 

Thank you,

StrongTypes
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 2:25:54 AM

0/0

If you're compiling dynamically, you'll need to use the MasterType directive to programatically access the master page. Otherwise, you should be able to access them by the class name of the master page. Also, you need to make those properties static.


Ryan Olshan
Microsoft MVP, ASP.NET
Blog | Group | Website | Strong Coders Community

How to ask a question
zoltac007
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 3:01:50 AM

0/0

Thank you for the reply.  I will give that a try - ( forgot how to make a static property for a minute )

StrongTypes
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 3:08:20 AM

0/0

You need to mark StateAbbrev as public. Leaving it as-is will defaut it to private.


Ryan Olshan
Microsoft MVP, ASP.NET
Blog | Group | Website | Strong Coders Community

How to ask a question
zoltac007
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 3:12:36 AM

0/0

I thought I knew what I was doing. What am I doing wrong here? 

CS0118: 'TemplateMP.DropDownList1' is a 'field' but is used like a 'type' 

Line 36:     public static string StateAbbrev
Line 37:     {   get
Line 38:     { string StateName = new DropDownList1.SelectedValue(); }
Line 39:     }

I understand what is being said but not what to do about it.

StrongTypes
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 3:30:58 AM

0/0

SelectedValue is a property.

public static string StateAbbrev
{
     get { return DropDownList1.SelectedValue; }
}


Ryan Olshan
Microsoft MVP, ASP.NET
Blog | Group | Website | Strong Coders Community

How to ask a question
zoltac007
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 3:37:11 AM

0/0

Still getting the same error:

Compiler Error Message: CS0120: An object reference is required for the nonstatic field, method, or property 'TemplateMP.DropDownList1'

Source Error:

Line 36:     public static string StateAbbrev
Line 37:     {
Line 38:         get { return DropDownList1.SelectedValue; }
Line 39:     }
Line 40: 

zoltac007
Asp.Net User
Re: Help with passing MasterPage variables7/23/2007 3:50:11 AM

0/0

I am going to try the MasterType suggestion you made as I looks to be a more robust and permanent solution for me.

Thank you

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


Free Download:

Books:
Dreamweaver CS3 Bible: Master Every Aspect of Dreamweaver - Work with CSS, Text, Images, And Links - Incorporate Flash Movies and Other Media Authors: Joseph W. Lowery, Pages: 1112, Published: 2007
Dreamweaver MX Bible Authors: Joseph W. Lowery, Pages: 1178, Published: 2002
Professional Digital Photography Authors: Bill Erickson, Frank J. Romano, Pages: 317, Published: 1999
Dreamweaver MX 2004: A Beginner's Guide Authors: Tom Muck, Ray West, Pages: 544, Published: 2004
Dreamweaver UltraDev 4: A Beginner's Guide Authors: Ray West, Tom Muck, Pages: 563, Published: 2001
Dreamweaver MX 2004: The Missing Manual Authors: David Sawyer McFarland, David Pogue, Pages: 836, Published: 2004
Dreamweaver 8: The Missing Manual Authors: David Sawyer McFarland, David Pogue, Pages: 936, Published: 2006
Dreamweaver 8: The Missing Manual Authors: David Sawyer McFarland, David Pogue, Pages: 936, Published: 2006

Web:
Help with passing MasterPage variables - ASP.NET Forums I have a master page with two drop down lists. After the user makes the two selections, State and City, they select one of two links taking ...
passing Session variables from contentPage to MasterPage - ASP.NET ... passing Session variables from contentPage to MasterPage. Last post 09-10-2008 10:56 PM by yuren1978. 3 replies. Sort Posts: ...
passing Session variables from ContentPage to MasterPage's Control ... Answer Re: passing Session variables from ContentPage to MasterPage's Control ... Visual Studio 2008 IDE, Debugger, Build, Deployment, Help, etc. ...
Passing flash variables... - ASP Free Passing flash variables... Multimedia forum discussing Photoshop, Shockwave, Flash, and any of the available multimedia technologies to help ...
How to Pass Variable between two content pages when using one ... NET, Passing Variables. What I have is this: 123.master content1.aspx content2. aspx Both aspx content pages us the 123.master page. ...
passing a value to masterpage - ASP.NET Forums hi friend, when passing like this to masterpage iam getting error,i had done like this .... MemberId * 100; //fetching value from the master variable ...
Steve C. Orr - How do I pass a value between an ASP.NET 2.0 page ... From the aspect of passing data around, the master page acts as a control ... to assign the master page reference to the _MyMasterPage variable because ASP. ...
Passing Data Between Parent and Child window - Haissam [MCAD] re: Passing Data Between Parent and Child window. Saturday, April 07, 2007 4:35 PM by Julia. Hi Haissam ,. if the parent page has connected with master page ...
Passing string value from content page to nested master page : ASP ... The remaining content comes from the main master page Site. ... I tried passing a string variable value from the Content page (ContentPage1.aspx) to the ...
CodeProject: Passing variables between pages using QueryString ... General, HELP!?! member, Philly Burton, 5:38 8 Oct '07 .... I use masterpage code behind to retrieve variables between pages. ...




Search This Site:










windows 2003 security settings

login control - authenticate event versus loggedin event

visual studio developer news unavailable on startup

blogger.com and dotnetnuke: are they compatible?

having problem modifying controls with new dnn 2.0.1 and dnn 2.0.2

vs 2008 doesn't support sql snippets!

datagridcolumncollection in aspx source

could not load type '_default'

any announcements/articles module???

remember user fails on a mac using safari

reference .net 1.1 assembly from an asp.net 2.0 project

problems with login control on iis

password seed...

bigfoot calendar

procedure or function aspnet_membership_getpasswordwithformat has too many arguments specified

what happened to the search module?

custom error handling

sortable gridview in webpart

menu underlines visited items in ie6 only

[1.2] - rss aggregation module

what is best way?...

updateing all profiles - little problem with that

is dnn bad security?

getting error names "the server {22148139-f1fc-4eb0-b237-dfcd8a38effc} did not register with dcom within the required timeout"

adapters & detailsview

passwordrecovery disaster

sqldataprovider/config.xml ?? security ??

configuration error, master file does not exist

wrapping content into contentplaceholder of masterpage

custom textbox and xp styles

 
All Times Are GMT