Web Forms :: Calling Master Page Method From A User Control?

Apr 5, 2010

Does anyone know how I would go about calling a method found in the master page code behind from a user control's code? The user control is on the master page. The method I want to call is public.

I can easily call a method found in the pages code behind using:

Page.GetType().InvokeMember("TheMethodsName", System.Reflection.BindingFlags.InvokeMethod, null, this.Page, null);

or I can call a method found on the master page from my aspx page code behind using:


But I am stuck because I can't find the MasterPage in my user control code behind.

View 4 Replies

Similar Messages:

Web Forms :: Calling A Page Method Using InvokeMethod From An User Control?

Jan 18, 2011

I have an aspx page which has an usercontrol say UC1 for selecting query paramters.

UserControl uc1 in turn opens another user control (UC2) as a modal popup.

1. On OK click, I am setting the values of another usercontrol (uc1) from the control uc2 by invoking a page method(doAccept). It appears to call the method and values seems to be set. But the problem the usercontrol/page does not display the new value or in otherwords it is not refreshed.

If the above is not possible is there any other way to refresh the parent page.


View 3 Replies

C# - Calling A Method On The Parent Page From A User Control?

May 3, 2010

I am using a user control that I created (just a .cs file not an .ascx file), that does some magic and depending on a value generated by the control, I need it to do something on the parent page that is 'hosting' the control. It needs to call a method under certain circumstances (method is on the parent control).the control is placed on the parent page like so:

<customtag:MyControl ID="something" runat="server" />

I'm dynamically creating buttons etc on the control itself but when a button is clicked, let's say for example that there's a text box on the control and if the value of the textbox is "bob" it needs to call a method on the page that's housing the control...how can I accomplish this?

View 3 Replies

AJAX :: Calling Parent Page Method From User Control?

Oct 3, 2010

I looked up the threads about this. But I couldn't do it...

this is my method in aspx.page:

public void MesajlariGetir()
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand("msjlarigetir", con);


View 4 Replies

Web Forms :: Calling Javascript Method During Page Load From Content While Using Master Page

Mar 30, 2010

I want to call a javascript method during page load. I am using application.master of the sharepoint server 2007 as the master page . In the content page i want to call a custom method named OnLoadFun() during loading the content page. I have written the function inside script tag in the PlaceHolderAdditionalPageHead id section of the content page.


How do i call the OnLoadFun method so the i is being called onload time. i tried putting window.onload=OnLoadFun surrounded by script tag within the PlaceHolderMain content section.

View 1 Replies

C# - Access Master Page Public Method From User Control/class/page

Oct 25, 2010

I am to access a method on my master page. I have an error label which I want to update based on error messages I get from my site.

public string ErrorText
get { return this.infoLabel.Text; }
set { this.infoLabel.Text = value; }

How can I access this from my user control or classes that I set up?

View 3 Replies

C# - Calling Method On Master Page From WebMethod

Aug 4, 2010

, imagine a Master page that implements IFooMaster with a method

ShowFancyMessagePopupTheBusinessCantLiveWithout(string message);

I am in a page that inherits this master page. Upon a checkbox being unchecekd, I want to show a message to the user that if they save it, they can't re-check the checkbox without some admin action.

I've been given feedback that I can't just use an alert('message'); in javascript because they want the consistent look of these messages.

Next, I tried to make an ajax call via PageMethods (as that's what everything else in this codebase uses) to show a message. My problem lies in this method being static.

public static void ShowSuperImportantMessage()
((IFooMaster)Master).ShowFancyMessagePopupTheBusinessCantLiveWithout("If you uncheck that thing, you can't recheck it.");

Since ShowSuperImportantMessage() is static, I can't access Master from within. The method on the master page looks more or less like this:

public void ShowFancyMessagePopupTheBusinessCantLiveWithout(string message)
lblGenericMessage.Text = message;
mpeGenericMessage is an ajaxtoolkit:ModalPopupExtender.

upGenericMessage is an update panel.The other 2 are obvious.

Can I do some jQuery kung-fu to show that stuff? I tried, but the solution complained that the controls I tried to refer to by ClientID didn't resolve since they were on the Master page.

quick edit: Before anyone tells me the architecture is a problem, or I shouldn't have put such a thing on a master page, or w/e...

I know the situation is not ideal, but I this is inherited code, and I can't drop it all and rewrite half of their web stack.

View 3 Replies

Web Forms :: Calling A Method On A Web User Control That Is Added At Runtime

Sep 23, 2010

I have a Web Form that uses Master Pages. I only tell you this part so you understand the layers.

On the page, I have a web user control. I can see public methods on that user control by simply calling userControlName.PublicMethod();

However, there is a button on this page which generates additional content. This content is based on a placeholder control and adding additional web user controls :


Now, on the main form, I want a submit button that will call a public method of each "subForm" that was added at runtime.

I have tried various forms of Control C = This.Page.Master.FindControl("cpBody").Findcontrol("ctl01")... etc, but can never seen to get the right combination.

Below is a listing of the web form


View 4 Replies

Web Forms :: Accessing A Public Property Of A Nested User Control In A Master Page From A Pages' User Control?

Sep 10, 2010

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?

View 5 Replies

Web Forms :: Calling Controls In A Page From A User Control File (.ascx)?

Nov 5, 2010

I have a page called main.apsx and on that page I have a multiview with a couple of view panes. In main.aspx I also have an have a buttons.ascx file with a few link buttons. When these buttons are clicked I want them to show the the selected view panels in multiview in main.aspx.

I cant seem to figure out where to put the action code for the link buttons. Do I put it into my buttons.ascx.cs file or into main.aspx.cs? I presume in buttons.ascx.cs, but if I do that, how will the buttons find the multiview control?

This is the code for on of my buttons in buttons.ascx.cs


When I run it like this is gives an error

The name 'MultiView1' does not exist in the current

The name 'View1' does not exist in the current

View 2 Replies

User Controls :: Call Master Page Method From UserControl

Oct 23, 2013

i have one method in master page and a label in same master page, and their is one method which changes text in label, and i want to call the same method in Master page from my Usercontrol.

View 1 Replies

Forms Data Controls :: Calling User Defined Grid Control Two Time's On A Page?

Mar 11, 2011

i created a user control and place a button on it.i drag dropped the user control on a aspx page and wrote the grid load and button clicks in the

user control.now i got a requirement to use the same user control grid and button to again use on the same page.however the data populated will be different and the button click functionality will be different.how can i reload the different data on the second grid as i had already wrote the code in the first one

View 2 Replies

Web Forms :: Cross-page Postback From User Control Included In Master Page?

Apr 4, 2010

I am tring to send form values to a page from a user control. I included the user control in a master page.When i use page.previouspage it can not get value. is there any way to send form data to a page from a user control included in a master page?

View 5 Replies

Web Forms :: Access User Control Of Master Page In The Content Page

Jan 27, 2010

I have a user control in the master of my website and I want change some property of that control from the content page.

View 3 Replies

Web Forms :: Control In Master Page - Get User Id?

Mar 8, 2010

I have a LoginView in my Master page:


I need to get the user ID from LoginName to use in my page's code behind:


But userID is null as it is not found in the master page. Could you suggest something to get the user ID?

View 5 Replies

Vb.net - Vb User Control Raising An Event On The Calling Page?

Apr 7, 2010

i'm trying to learn about user controls. I created a user control that has a textbox and a button. What i'd like to be able to do is when i click the button in the user control, populate a label in the aspx page. I understand that i could just have a button on the page that uses some properties on the user control to get that information.. but i'd like to know how to do it with the button the user control.. the reason for this is the button is just an example.. a learning tool. if i can get this working, i'd likely be putting thing in the user control that might require this kind of passing information. Anyway.. i've found some c# examples that i tried to get working as vb.. but once started getting into the delegates and events.. well.. it made me turn to this post.

View 3 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 :: Getting Value From User Control In Master Page In Content Page

May 11, 2010

There need to read selected value from drop down list which is in user control (user control is placed in master page) in contect page.

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 :: Calling Method From Control Property?

May 18, 2010

I'm trying to call a method from a control's event property.

Ex. <asp:textbox id="textbox1" runat="server" OnLoad="test" />

Code Behind:

public void test(object sender, EventArgs e)

View 6 Replies

AJAX :: 401 Unauthorized Error In App, AJAX Control Calling Web Method Within Same Page

Jan 10, 2010

I'm using a custom AJAX based validation control to check user name availability from database. It's working alright in my development machine but in production server we are using Windows Authentication to authenticate by domain.The control is inherited from base validator and checks for user name availability from database perfectly but on form submission at Page.IsValid check it gives the following error.

remote server returned an error 401 unauthorized

Both the form and webmethod are in the same page/file. I even tried creating webmethod in a separate standalone webservice but error still there.

View 2 Replies

Web Forms :: Call Master Page Function From User Control?

Jul 22, 2010

I have a Masterpage and a UserControl inside the MasterPage itself.

I have a public method named PerformDragAndDrop inside the MasterPage and I want to call this method from the userControls's code behind.

View 9 Replies

Web Forms :: Page Life Cycle Of With Master And User Control?

Jan 12, 2010

I want to find out the page life cycle of a page contains: master page, content page, user controls. I have seem a guru posted the whole events sequence of such a page here in this forum but can't not find it again. give me the link to that post or provide answer directly?

View 2 Replies

Web Forms :: Control Is Not Going To Visible After Calling The Method In JQUERY?

Aug 10, 2010

I called the server side Method using AJax and inside Method iam going to Add the Media Player to Place Holder i debug the code every thing is ok but Place Holder is not Displaying any thing.

Here is my code of JQUERY


and Here is my server side Method


and in aspx code i just put the DataList for binding the Thumbnail Images and Place Holder control for displying the Media Player .

But Place holder is not going to visible after the calling sercer side Method to JQUERY. Is there any thing iam doing wrong.

View 5 Replies

Web Forms :: Css, Master Page And Web User Control - Background Image Does Not Load?

Apr 26, 2010

I have a stylesheet attached to a master page and a web user control attached within that master page.

here is the css code


background-image: url (image.jpg);

in the master page, i create a div inside the made called "searchBox". Then, I have a web user control inside that div. However, my background image does NOT load. How can I resolve this?

View 1 Replies

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