Web Forms :: Accessing Master Page From A Base Page?

Oct 11, 2010

I have a custom basepage and a master page in my web application. In my master page, there are events that I run from each page in my web application. Instead of putting the code in each of my pages, I decided to create a base page that each web page will inherit from. Trouble is, I cannot get the base page to invoke the events on the master page.

View 1 Replies


Similar Messages:

Web Forms :: Accessing Master Page's Body Tag From Aspx Page That Is Not A Content Page

Jan 8, 2011

I am using Master page and Content page combination.But how can i access <body> tag and it's event (onload, onunload) of Master page in .aspx page that is not a content page.

View 12 Replies

Page With Base Class With Dynamic Master Page Not Firing Events

May 3, 2010

I am feeling that I have terribly wrong somewhere. I was working on a small asp.net app. I have some dynamic themes in the heme folder and have implemented a page base class to load the master page on the fly. The master is having the ContentPlaceHolder like: <asp:ContentPlaceHolder ID="cphBody" runat="server" />

Now I am adding pages that are derived from my base class and added the form elements. I know, Visual Studio has problem showing the page in the design mode. I have a dropdown box and wish to add the event of onselectedindexchange. But it is not working. the page is like this:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="trigon.web.Pages.MIS.JobStatus" Title="Job Status" AspCompat="true" CodeBehind="JobStatus.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphBody" runat="Server">
<div id="divError" runat="server" />
<asp:DropDownList runat="server" id="jobType" onselectedindexchange="On_jobTypeSelection_Change"></asp:DropDownList>
</asp:Content>

I have also tried adding the event on the code behind like:

protected void Page_Load(object sender, EventArgs e)
{
jobType.SelectedIndexChanged += new System.EventHandler(this.On_jobTypeSelection_Change);
if (!IsPostBack)
{
JobStatus_DA da = new JobStatus_DA();
jobType.DataSource = da.getJobTypes();
jobType.DataBind();
}
}

protected void On_jobTypeSelection_Change(Object sender, EventArgs e)
{
//do something here
}

View 1 Replies

C# - Accessing Top Master Page Properties In A Nested Master Page Code Behind?

Feb 18, 2010

I have a nested master page that has its own master page. The parent master page has a property defined in its code behind.

Public ReadOnly Property SelectedPage() As String
Get
Return _selectedPage
End Get
End Property

How can I reference the parent master page's property from within either the child master page's code behind Page_Load or aspx template page?

View 3 Replies

Web Forms :: Accessing Master Page From Content Page - Raising Event?

Sep 10, 2010

Here is my situation: I have a user control that has a menu in it. This user control sits on my master page. It is my main navigation menu for my application. I am having an issue where, on one of my pages, users seem to be leaving the page before committing all changes to the database, which results in a loss of data. So what I want to accomplish is - if the user is leaving this page and the data has not been saved yet, I want to prompt the user and say something like "The information is not yet saved, are you sure you want to leave this page" in a modal popup. So my approach is this: In my menu user control, create an event handler called MenuClicked that is raised when the menu web control's (in the user control) MenuItemClicked is raised, I raise my custom MenuClicked event. Then on my master page, I can catch this event in NavMenu_MenuClicked. My problem is - I need to catch this event in my content page, not the master? Am I approaching this correctly?

View 2 Replies

Web Forms :: Accessing Public Property Inside User Control In Master Page From Content Page

Nov 9, 2010

I have user control in the master page. user control code behind page having public property called SetValue.

Now I want to set the value from content page .

View 4 Replies

Web Forms :: Accessing SiteMapDataSource On A Child Page From A Master Page?

Jan 19, 2011

I am just starting out with ASP.net and C#.

I have a master page that contains the main site navigation and a child master page that contains a secondary menu. I want to set the starting node on the secondary menu based on the selection on the main menu.

I can get the code to work when the menus are on the same page, but when I separate them into their respective master pages, I get an error saying "The name 'SiteMapDataSource2' does not exist in the current context".

I have tried playing around with the FindControl() method, but either it won't work or I'm not getting the syntax right. Most of the information I find is for a child page referencing the master page, but not the other way around.

How can I access the SiteMapDataSource2 control from the master page? If possible, can you include the exact syntax as I am still trying to get the hang of this.

Here is a basic representation of my code, with all of the uncessary stuff stripped out:

Master Page

[Code]....

Master Page Codebehind

[Code]....

Child Page

[Code]....

View 2 Replies

Web Forms :: Access Base Class Functions From Master Page?

May 14, 2010

I have a base class called BasePage, and a master page called SiteMaster. All my content pages inherit BasePage using BasePage instead of System.Web.UI.Page. Now, I need to access some functions in BasePage from my master page SiteMaster, let's say, the function is called "DisplayClientName()". How can I do it? Searched the Web, have found tons of similar questions but not solid solutions.

View 2 Replies

Web Forms :: Reference Control On Third Level Master Page From Content Base Class?

Aug 8, 2010

I am attempting to access a textbox control on a master page from a code behind base class but having problems. I have 3 levels of master pages. m1.master is the master page for m2.master which is the master page for m3.master.m3.master has a textbox as shown below

<%Master
Language="C#"
MasterPageFile="~/m2.master"
AutoEventWireup="true"
CodeFile="M3.master.cs"
Inherits="M3"
%>
<asp:Content
ID="Content5"
ContentPlaceHolderID="M2"
Runat="Server">
<asp:TextBox
ID="text1"
runat="server"
></asp:TextBox>
<asp:ContentPlaceHolder
ID="M3"
runat="Server"></asp:ContentPlaceHolder>
</asp:Content>

I have a content page c1.aspx that uses m3.master as its master page as shown below:

@
Page
Title=""
Language="C#"
MasterPageFile="~/m3.master"
AutoEventWireup="true"
CodeFile="c1.aspx.cs"
Inherits="_c1".................

View 2 Replies

Geting Error When Accessing RadioButtonList From Javascript That Exist In A Page That Have Master Page?

Mar 13, 2010

i have a asp.net page that have its master page and it contain RadioButtonList1 and i try to do thefollwing

<script type="text/javascript">

var radioButtonList = document.getElementById('<%=RadioButtonList1.ClientID%>');
if(radioButtonList[0].checked)
document.getElementById("_secondTR").style.display = "block";
else if (radioButtonList[1].checked )
document.getElementById("_secondTR").style.display = "none";
}
</script>
<table style="width: 100%">
<tr id="Tr1">
<td>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" BackColor="#FFCC99"
RepeatDirection="Horizontal" Width="117px" onclick="ShowHide()">
<asp:ListItem Value="1">Yes</asp:ListItem>
<asp:ListItem Value="0">No</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr id="_secondTR" runat="server" style="display: none">
<td>
<asp:RadioButton ID="Five" runat="server" GroupName="1" BackColor="#669999" />
<asp:RadioButton ID="Four" runat="server" GroupName="1" CausesValidation="True" BackColor="#669999" />
</td>
</tr>
</table>

i can't get RadioButtonList1 from java script ...

View 2 Replies

Accessing Controls / Events On A Master Page From Child Page

Sep 3, 2010

I have a problem i am trying to work out the best method with my limited skills. Im using vb.net(VS 2010) I am using a dll for an IFrame , which is call from code behind. On my site I havea masterpage which has two gridviews. ( GrdViewWebBureau is the one i am using for this query) GrdViewWebBureau is contained within an update panel and updated on a timer control trigger. GrdViewWebBureau updates the page with file counts and status from our clients. I can click on any one of the cells and the code behind is fired. What I am trying to do is put an IFrame on the master page and every time a user clicks on the grid, the Iframe is fired up.

I have tested the iframe and vb code behind from a dummy page and it works, however when the Iframe is on the master page it doeant work. What I am tryingh to achieve is that no matter what page a user is on the site, they will be able to click on the GrdViewWebBureau and the iframe will fire with the correct childpage. Each webPage may also have an Iframe as well, so i dont know if it is possible to make the IFrame global and just call that control ?? I have no idea if 1 this is possible with the code i have and 2, if i have the brains to understand the who what why and when.

[Code]....

View 1 Replies

Web Forms :: Master Page Controls Accessing Controls Inside Content Page And Vice Versa

Jan 26, 2011

i have a masterpage and has some linkbuttons in it, i also have a webform which is a content page for the masterpage. i like to access the controls to the webform via the linkbutton residing in the masterpage or access the linkbuttons via the webform controls.

View 1 Replies

Forms Data Controls :: Accessing Master Page Controls From Content Page Formview?

Sep 22, 2010

I have a master page with a textbox that I want to use for a search, and display the results on the content page.

I've dragged in the datasource to the content page, and configured the formview to use that datasource... almost.

The issue I'm having is that on the last step of the configure datasource wizard where you select the parameters, I want to select the master page textbox control for the search parameter... but of course it's not available in the list. The list only allows me to choose controls from the content page.

How do I set this master page search box as the parameter for my datasource?

View 4 Replies

Accessing -Text Property In Master Page From Master.cs

Aug 3, 2010

I have a textbox and a button, and I trying to give the user a search option in the master page. The onClick event of my button is fine, but the textbox.Text property is always empty. I googled a little and fine many articles about accessing the Master from the ContentHolder, but I believe its no my case...

View 1 Replies

Web Forms :: Accessing User Control That Is In A Master Page?

Sep 9, 2010

I have looked everywhere for how to do this and all I come up with is threads describing how to expose public properties. I have a USER CONTROL in my Master page. It is a search box with a text box and a dropdown for search type (last name, account number, etc) and a search button. When the user clicks the search button, I open a new page that displays the results. How do I pass the values from the USER CONTROL search fields to the new page? I would post code, but I have nothing to post yet since I don't know where to start. I have tried exposing the public property of the user control, but I don't know how to retrieve those values on the results page.

View 7 Replies

Web Forms :: Accessing User Identity From Master Page?

Jan 23, 2010

When I use a Master Page with a Content Page, in the Content Page script I find that User object is defined, with Identity and IsInRole properties. However, when I enter script on the Master Page itself User comes up as "not declared".

I am guessing that User is embedded in some namespace that is automatically imported to Content pages, but haven't been able to track it down.

View 1 Replies

Web Forms :: Accessing Content Title From Master Page?

Dec 8, 2010

I've done this a bazillion times but today my mind is simply blank and because it is so easy I've no notes on it.

If I set Title="foo" in the <%@ Page directive of my content page, how do I reference it in the code behind of my master page? I need to use it in a Select Case.

I swear, if my head wasn't permanently attached, I'd have lost it somewhere today.

PS. This question is only silly because I'm asking and I should know the answer.

View 2 Replies

Search Pages And User Controls To See Which Master Page And Base Class They Use

Feb 12, 2010

I want to search my asp.net pages and user controls to see which master page and base class they use. I mention search because we are re-factoring a large project and we need to track progress on the code conversion. I know I can pull this information individually but I need a automated and repeatable procedure.

View 1 Replies

Web Forms :: Accessing Master Page Control From Class File?

Aug 27, 2010

i have to write this piece of code in almost 10 to 15 content pages. i am just wondering if i can class file as base class for my content pages and write this piece of code in that class.

[Code]....

can somebody guide me how to write the base class for this scenario?

View 6 Replies

Web Forms :: Accessing Control Name Inside A Contentplaceholder In Master Page Using Javascript

Apr 26, 2010

I have a asp.net webpage which is using an Master page and contentplaceholder.

My Req: I want to access the control name through javascript.I have tried to use 'document.forms[0].elements[i].name' but its giving an error since my page there is no form.Only master page and contentplaceholder.

View 1 Replies

Web Forms :: Master Pages - All My Pages Inherit From The Base Page Class

Jun 21, 2010

Currently I'm doing common functionality required throughout my site inside of my masterpage. What I want to do is move this functionality to a BaseClass so All my pages inherit from the Base Class. However, I'm not sure how to set this up interms of c# code with regards to Using a Base Class and then having a masterpage applied to my aspx pages that i create.

View 5 Replies

Web Forms :: Accessing Control From Master Page On Asp:Wizard Step Change Event

Mar 19, 2010

My requirement is to disable a control on Master page when user is on some specific step of asp:wizard control. I am facing 2 challenges,

1. I am not able to disable the control master page by setting its Enabled property as false, this is inspite that I am getting the control object when I do a Master.FindControl("MyControlName").

2. To try and disable the control from JS, I am not able to find a JS event that would get called when a speific tab step get active and loaded.

View 1 Replies

Web Forms :: Accessing Master Page Content From Content Page?

Feb 16, 2010

I am having asp:hyperlinks in my master page, which i use as my page headers. I would just like to change the text format of the hyperlink when a content page is loaded.

the CS code for accessing the master page contents from content page?

View 3 Replies

C# - Accessing A Master Page From Httphandler?

Apr 9, 2010

I am developing a small application in asp.net (writing in c#). In my application I am using jquery to perform asynchronous call to the server. I have an http handler that listens in to the requests and does what it needs to do.

Problems start when in the handler I need to access information stored in the page , from where the asynchronous call started. When I try this:

Page page = HttpContext.Current.Handler as Page;

I don't get a page.

How else can I access the page itself?

View 3 Replies

Accessing Master Page Objects From Classes?

Mar 22, 2011

I have a single master page in my application. It has a Label control for displaying Error Messages. I want to be able to access this Label control from any child page or Class module within the application. How do I reference this label from a Class module. I simply wish to use a Try Catch construct in the Class Module and reference the MP Label in the Catch segment.

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved