CodeVerge.Net Beta


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




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 12/19/2006 10:29:04 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 3 Views: 49 Favorited: 0 Favorite
4 Items, 1 Pages 1 |< << Go >> >|
EvanCowan
Asp.Net User
pass parameter to a usercontrol on the master page12/19/2006 10:29:04 PM

0


Hi

I have a user control called MainMenu
I send it a parameter of PageID from my host page code behind like this

MainMenu1.PageID = "100";

It works fine.

I want to put the MainMenu.ascx file into the master page that the host file uses. I cant figure out how to set the PageID once it is in the master page.
I get errors saying that MainMenu doesn't exist in this context.

Thanks
albertpascual
Asp.Net User
Re: pass parameter to a usercontrol on the master page12/19/2006 10:57:31 PM

0

Create a public property on the master page that sets the usercontrol pageid so every webform can set the id by calling MasterPage.PageId that sets the Usercontrol1.PageId. Makes sense?


Cheers
Al

My Blog
Please click on 'Mark as Answer' if this post answered your question!
EvanCowan
Asp.Net User
Re: pass parameter to a usercontrol on the master page12/19/2006 11:23:54 PM

0

yup. makes sense, but doesnt work.

on my host page (using a master page) 

MasterPage.myPageID = Request.QueryString["PageID"]; 

 I get the error:

'System.Web.UI.MasterPage' does not contain a definition for 'myPageID'  

On the master page i have added:

<script runat="server">
    public string myPageID = "0";
    protected void Page_Load(object sender, EventArgs e)
    {
        MainMenu1.PageID = myPageID;
    }
</script>

 

Thanks! 

albertpascual
Asp.Net User
Re: pass parameter to a usercontrol on the master page12/20/2006 1:10:18 AM

0

Why are you using Query String?

first create a property called myPageId on the master page

public string myPageID

{

 set { Usercontrolname.Pageid= value;}

 get { return Usercontrolname.Pageid; }

}


Cheers
Al

My Blog
Please click on 'Mark as Answer' if this post answered your question!
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Expert C# 2005 Business Objects Authors: Rockford Lhotka, Pages: 668, Published: 2006
The Visual Basic Object and Component Handbook Authors: Peter Vogel, Pages: 668, Published: 2000
Programming Microsoft Visual Basic 6.0: [master Object-oriented Programming Techniques for Rapid 32-bit Development] Authors: Francesco Balena, Pages: 1276, Published: 1999
Visual Basic.NET Black Book Authors: Steven Holzner, Pages: 1144, Published: 2002
The Software Catalog: microcomputers, winter 1985 Authors: International Software Database, International Software Database, Pages: 1700, Published: 1984

Web:
ASP.NET.4GuysFromRolla.com: Passing Information Between Content ... Jan 31, 2007 ... Passing Information from a Content Page to its Master Page .... apply equally to Master Pages (the User Control) and content pages (the ASP. ...
pass parameter to a usercontrol on the master page - ASP.NET Forums pass parameter to a usercontrol on the master page. Last post 12-19-2006 8:10 PM by albertpascual. 3 replies. Sort Posts: ...
How to pass parameter to a User Control with a link - ASP Free I need to pass a parameter to my user control with a hyperlink. ..... Use master pages when • Not concerned about a full page refresh ...
Making postback/AJAX request from javascript in user control ... Grid in Master page and RaisePostBackEvent handling .... AjaxRequest() method ( passing the necessary information as parameters to it) and then override the ...
C# .NET master page to usercontrol i want pass the value from usercontrol on the master page .how to pass the vaule from page to usercontrol?please very urgent withour events and delegate. ...
Passing parameter from one user control to another - ASP.NET Forums What would be the best way to pass a parameter from a user control in one part of a master page to another? I have a mast file: site.master ...
Passing Parameters to User Controls that are Dynamically Loaded in ... How do i pass parameter into the user controls "c1", "c2" ? Here is a bit of my code that is calling the user control from the aspx page. ...
Steve C. Orr - How do I pass a value between an ASP.NET 2.0 page ... To pass data from the master page to the page, the master page should raise ... The page can handle the event just as if it were coming from a user control: ...
User control remember state across pages without session - .NET ASP Net 2 via master pages). When I navigate from one page to the next ..... session or passing parameters to the user control on each page that ...
How do I pass a variable from my masterpage to a content page ... Experts, I have an asp:dropdown on my master page and I need to pass the value a user selects in the dropdown to another page that also inherits the same ...












image in masterpage not working when pages are in sub directory

how to access the menuitem through javascript

print preview of a page different from what it comes out after printing...... css issue

treeview as file explorer

css template needed

access masterpage control in content page html

sitemap question.

menu links should be colored diferent

hide menu item based on roles

menu control problem

site map

stop masterpage from reloading

ie cannot open my localhost page - operation aborted - but firefox works fine

menu using sitemap, where to specify imageurl?

modifying a master page.

invalid cast to masterpage type

batch=false and precompilation

master.master.someproperty from page of a nested master fails at runtime (sometimes)

on masterpage a javascript window.open - opens a new age in contentplaceholder

dynamicmenuitem odd resize

using asp:table in master page makes design view not useable for content pages

menu

getting the name of the child or calling page from the .master.cs code behind

master page error.

what's wrong with this code?

finding value of dynamic control within a masterpage/contentpage system

how to set a background picture to my masterpage so all the pages background take it as the default background?

best way for content page to set a property on its master page?

proper way to link to images on a theme directory.

sitemap.rootnode only seems to return the default provider root node

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT