I've got a web site that has a master page and that master page (mpMaster that has a user control ucControl1) which has a sub user control (ucControl2), this user control has a property which accepts a value. Now, I have a page that uses the master page and on this page I have another user control (ucPageControl), I need to find a way of setting the value in ucControl2 from ucPageControl. Is this possible at all?
Here's the scenario: A class based on System.Web.UI.Page has been created. A number of content pages derive from this class. All of these content pages use the same master page. The content pages define controls which need to access things on the master page (in code-behind). This is fine - no problem. In particular, each content page has its own data grid. The grid on each page has the same name, so that common code can reference it. In fact, some event handling for the grids on each content page is identical, so would like to factor that code to the base class. Interestingly, I can actually define the event handler entirely in the base class, with no stub in the content class at all, because the wire-up of event handlers uses the event-handler name defined in the grid, and that name happens to be found in the inherited base class. All good and dandy... very cool in fact. The problem comes when the code in the base class needs to access any of the common elements from the content page's master. Remember, the master is the same, and I know the type of the master. I would like to do something like this in the base-class code:
The problem is, that myMasterType - the type of the master page the content pages are using - is not available at compile time, at least not from a class definition for a base page. I've found articles that claim that the class name of the master is available - and it is, but not from a separate class. I CAN see it and compile with the master's class name from, for example, the code behind of the various content pages. But the actually class simply isn't available, it seems, from a pure class (the base page class). Judging from other times this question has been asked, here are common misunderstandings offered as solutions: 1. Use a page directive to declare the master type. This is not even vaguely a part of the problem, as the issue is not code in the content page, but in a separate base class which content pages inherit from. That base class is a pure class -- no .ASPX file at all. 2. Pass a reference to the master object from the content page to the base class. This can be done, but is pointless, because I can already get it, using "this.Master" from the base class! But because the type of the master is not available at compile time from the base class, it can't be passed from the content page either - unless it is passed with type MasterPage, thus losing all the properties/methods publically defined in the specific master page class. 3. Move the base page class out of the App_Code folder because the app_code folder is compiled before the other classes, and thus before the master page class. Doesn't work -- put the master page class file right in the same folder with these content pages and their master page, and the master page class is still not available at compile time from within the class. Re-summarized: Base page inherited by content pages. Content pages all use a common master page. Want to access the public properties of that master page from the base page, at runtime. Barrier is that I can find no way from within the base class to cast the master page object to the actual master page subclass being used.
I am working in a product which is developing using telerik rad controls. Site have a master page which includes rad toolbar for main menus like file, edit etc.
When the site worked in IE 8 the half of the menu got inside of the content page. I changed the compatability settings of IE 8 to comptabality view and it solved. So i can view the site correctly. But in firefox also have the same issue. There not any compactability settings like this ( i think). So how can solve this? I mean wat issue is this ? Any css issue or any control behaviour?
I have a web page (Orders.aspx) that gets some orders and show them in a Gridview .The orders list I get from DB is depend on a field named Status. The page has a master page that contains a Tab user control. The user control has several tabs and every tab has a different Status. Therefor, when the user clicks on every tab, I want to pass a value as status to my content page (Orders.aspx) and then select the orders from DB based on status.
in my application i am using master page and child pages. my requirement is can i access the master page controls in child page exmaple in my master page i have a linkbutton how can access in childpage
I have a master page setup that is used throughout my site that is basically a header with a menu. I recently added a textbox and a button to this master page which is to be a quick search box that is available anywhere in the site. When a user enters text into the search box and hits the button, I need to load the actual content page which is used to search and show search results (which also uses this same master page), and have the text entered available so the search can be triggered automatically. Again, this search text box and button is now in my master page so it could be triggered from anywhere in the app... it serves as a convenient way to do a basic search from anywhere in my app, without having to first navigate to the actual 'search page' that already exists. You can also navigate to the actual search page, which uses the same master page, where there is many more search options.I'm thrown off by the master page arrangement, which I have not used until this project. What do I do?
I have created a very simple calendar user control that contains a public property which is used to define which month/year to display. My calendar control is placed inside another ascx control (the wrapper control essentially), which includes LinkButton controls used to toggle the calendar control forward and backward one month at a time.
If I explicitly define the SelectedDateTime property of the calendar control in the wrapper control at design time, the proper month/year are displayed by the calendar control. However, when I try to set the property value at run time using a Click event on the previous and next LinkButton controls, the calendar control never picks up the new SelectedDateTime value I try to assign to it.
When I run the code in debug mode, the Click event of the LinkButton always happens last - after the value of the SelectedDateTime property of the calendar control has already been set to default and rendered. What am I missing?
The calendar control is placed in the wrapper control just like any old control:
this is probably something really simple but I cant see what! Any images I have in a masterpage aint showing in child pages, all i get is the box with the red cross in it. Dont think Ive done anything different from usual and its not something thats happened in other sites so im kinda scratchin my head with it.
I have a hidden field on my default.aspx page. Within default.aspx page I have a user control which has a label on it. I need the label to display the value on the hidden field. How can I go about this?
We have created a Master page that inherits off the asp.net Master class.We have also got ui controls that inherit off the standard asp.net ui control class.Our Master page has a public member variable. We need to be able to access that member variable from the ui controls that we use.However we can't seem to get at it? Is it our architecture that is wrong? Or the idea itself - user control getting acces to Master page variables?