Can I have a web user control call a method on the page it's parent page?

I'm building an application where I'm using serveral different controls on a page and as one of them causes a postback I may want the page to make changes to other controls.  Is there a way to either fire and event off from the control that the page could then capture or simply have the control call a method of it's parent page?

Obviously the Page object is there to work with, but I can't seem to figure out how to specifically cast it as a specific page.

0
Joel
4/18/2008 5:31:49 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
849 Views

Similar Articles

[PageSpeed] 9

 For real man,

In your user control you need to create a public event which is raised by the event of the control.
Check out these links:
http://codebetter.com/blogs/brendan.tompkins/archive/2004/10/06/Easily-Raise-Events-From-ASP.NET-ASCX-User-Controls.aspx

http://forums.asp.net/p/1023083/1388138.aspx#1388138

 

 


Alexei Fimine
_____________
Don't forget to mark this post as "Answer" if it indeed answered.
0
fimine
4/18/2008 5:46:01 PM
Reply:

Similar Artilces:

how can you display another web site's web page in your web page without leaving your site
Can you display another web site's web page in your web page without leaving your site? I know you could use a frameset with .asp, but it looks like Visual Web Delevoper 2005 does not have any controls to setup a frameset. Any help, that would point me in the right direction would be great. Thanks Patrick     With screen scraping 4GuysFromRolla.Com: Screen Scrapes in ASP.NEThttp://www.4guysfromrolla.com/webtech/070601-1.shtmlThanks,Teemu KeiskiFinland, EU Thank you. This information was a great help!!! Thanks again Patrick...

Blank web pages with Trillian's user web pages?
Is anyone else having this problem too? Flash v10.0 r32 loads, but no datas show up after that. Examples: http://www.trillian.im/users/vedran and http://www.trillian.im/users/antdude ... Both showed nothing in both Mozilla's SeaMonkey v1.1.17 and Firefox v2.0.0.20. No problems in Internet Explorer v6.0 SP2. Thank you in advance. :) -- "The ants are back Ted!" --Dougal from Father Ted TV show. /\___/\ / /\ /\ \ Phil/Ant @ http://antfarm.ma.cx (Personal Web Site) | |o o| | Ant's Quality Foraged Links (AQFL): http://aqfl.net \...

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: http://msdn2.microsoft.com/en-us/library/ms178139.aspxAlso: http://msdn2.microsoft.com/en-us/library/ms178140.aspx might ...

'Can't save web pages, Ctrl+S. 'Can save same pages from I.E
Name: Del Dyreson Email: drdyreson_at_earthlink.net Product: Firefox Summary: 'Can't save web pages, Ctrl+S. 'Can save same pages from I.E Comments: 'Can't save web pages, Ctrl+S. 'Can save same pages from I.E. I'm running Win2000Pro, Ver 5.0 (Build 2195, Service Pack 4). Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 ...

Single page with multiple user web controls VS Multiple page with specific user web controls
I have a question regarding single page with multiple user web controls vs multiple page with specific user web controls   Option 1: I am of the opinion to have multiple pages with specific user web controls and use an object to store all the information as the user navigates through the application. And finally at the end, read this object and save all the information to the backend database.   Option 2: My respected team member suggests that we have only one page, with all the specific user web controls and not use an object, instead show/hide the user web controls based ...

Call method in Parent page of Web User Control
How can i access a method that is placed in the Parent page of the Web user control i have made? I'm placing the code in the codebehind files. By the way, when I'm talking about Parent page i mean Web Form, and I'm using .NET 2.0. Have found some articles about this theme but for 1.0, and when i tried it didn't work. ....and I want to access a method in the parent page from user control..sorry for poor explanation... You could wire an event handler into the child control that will call a parent control / page's method. Ok, could you please show me a example or if you know one good tu...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

how to add theme for a web page when it's calling form windows application using Web Request class
Hi Everybody, I want to apply theme for a web page when it's calling from windows application using web Request class. Here is the code in windows applicationpublic static string GetPageHTML(string url) {string strHtml = String.Empty; try {Uri uri = new Uri(url); WebRequest resq = WebRequest.CreateDefault(uri);WebResponse resp = null;StreamReader sr; resq.Timeout = 99999999; resq.Credentials = CredentialCache.DefaultNetworkCredentials;resq.PreAuthenticate = false; resp = resq.GetResponse();sr = new StreamReader(resp.GetResponseStream()); strHtml = sr.ReadToEnd(); }catc...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how...

Where are my web controls? Uh-oh, where's my web page?
What shall I do? I've taken an html page, provided by another person, and replaced the html controls with asp webcontrols. I've adjusted the pages meta data and headers to reflect the vb codebehind. All asp web controls are also contained in a form with runat="server". Here's the kicker. When I look at the form in design view, it's all there, however, when I run it from my browser--no web controls :( I found a forum user that successfully fixed this problem by running aspnet_regiis.exe -i from WINNT\Microsoft.NET\Framework\v1.0.3705. I did the same and now when I attempt t...

User Control Within UserControl
If I have a user control A and then inside it a user control B embedded/referenced within it.  User Control A has a panel defined (cpeNewUser) that I want to manipulate from the code behind of User Control B based on some event that happens.So putting this in my code behind of User Control B won't work as it has no idea of cpeNewUser:cpeNewUser.Collapsed = true;So is it because only at runtime they are married up and because of this you cannot access each other's objects at compile time?  How would I get this to work becuase I'm using all user controls inside a AJAX Too...

User control can't access the parent page's public properties
Hi Guys I have built a page that is contained within a master page and it holds 2 user controls Control A contains a DataListControl B contains a FormView I want to pass the selected index from the DataList on Control A to the FormView on Control B so it acts like a master / detail scenario I created a public property on the page that contains both controls called DataListSelectedIndex A also created a public property for DataListSelectedIndex on the Control  I populate the DataListSelectedIndex property of the Control when the DataList_SelectedIndexChanged...

Web page .aspx is slow when loading. Pages have web user controls on them that are loaded dynamically
I have written a web application using VS 2003. Several of my forms have web user controls on them. The controls are loaded dynamically at runtime. The problem is that the web pages are very slow to load. Does anyone know if there is a way to speed up the pages being loaded into the browser? Here is an example of some code I use to dynamically load the controls:  private void Page_Load(object sender, System.EventArgs e)  {   // Put user code to initialize the page here   // Put user code to initialize the page here    Co...

Call public method on aspx page from a web control embedded in the page
I have a nut to crack. How do I call a public method on my aspx page from my web control, the web control is embedded into the page. The markup looks like this:-   1 <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 2 <ContentTemplate> 3 <asp:Xml ID="Xml1" runat="server"></asp:Xml> 4 <uc2:tier3menu ID="menu1" runat="server" /> 5 </ContentTemplate> 6 </asp:UpdatePanel> I wrote an itemcommand thingie in the web control that needs to set the Documentsource a...

Web resources about - Can I have a web user control call a method on the page it's parent page? - asp.net.web-forms

Resources last updated: 11/29/2015 1:59:38 PM