Doing Postback from master page to page in master's content place holder(search page)

Hi, Currently I am trying to do a postback which returns results.

The master page has a textfield and button and the button redirects to the search page.
The search page also has a textfield and button and when the button is clicked, the query statements take the input from teh user and looks for results.

Currently, A Crosspage postback of master page + other pages in content place holder ------> master page+search page in content place holder works.

I am trying to do a postback which returns results in master page+search page which gets its input from the textbox of the master page without affecting the function of the search page.
Meaning that the search page's button still can retrieve the results on its own and the master page's button gets the input from the textbox(master page) and executes the button click event of the button(search page).

Below is the back end code that I used.

1    protected void Page_Load(object sender, EventArgs e)
2        {
3            if (PreviousPage != null)
4            {
5                TextBox retrieved = (TextBox)PreviousPage.Master.FindControl("crossSearchTextBox");
6                basicSearch.Text = retrieved.Text;
7    
8                if (basicSearch != null)
9                {
10                   Go_Click(Go, EventArgs.Empty);
11               }
12           }
13   
14           if (Session["usertype"].ToString() == "Librarian" || Session["usertype"].ToString() == "LibraryUser")
15           {
16               Panel3.Enabled = false;            
17           }
18   
19           if (!Page.IsPostBack)
20           {
21               Panel2.Visible = false;
22           }
23   
24           if (Request.QueryString.Get("type") == "adv")
25           {
26               Tabs.ActiveTabIndex = 1;
27           }
28           else
29           {
30               Tabs.ActiveTabIndex = 0; 
31           }
32       }

basicSearch is the textbox of the searchpage.
crossSearchTextBox is the textbox of the master page.
Go_Click is the event for the button of the search page.

Can someone help me regarding this problem? Thanks.

0
shacky
7/10/2007 1:15:07 AM
asp.net.navigation-controls 13714 articles. 0 followers. Follow

2 Replies
971 Views

Similar Articles

[PageSpeed] 29

I did not understand what you want. Maybe is this.

This link above is a link that shows how to make a partial page update using asp.net 2.0 and the ajax framework.

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=78 

0
leoalves
7/10/2007 2:31:10 AM

Simply put, search page and the other pages go into the content place holder of the master page.

What i am trying to do is to make the search work in master page with search page in the content place holder.
Like crosspage post back that i stated earlier on in the codes, i would like to do the same for the problem now.

0
shacky
7/10/2007 2:41:36 AM
Reply:

Similar Artilces:

How to set a Master Page's control's property through content page on a postback event?
Hi all, i m using a master page in my application. i have a panel on master page and a tab container with three tab panels on content page. i want to set/change  the visibility of the panel control when the tab is changed on the content page. By default the panel is invisible. To implement this i executed the following steps: 1. Set AutoPostBack of tacontainer to true 2. Wrote an event handler for ActiveTabIndexChanged event of the tab container 3 Wrote the following code on Tab changed event   if (TabContainerEmpPerformance.ActiveTabIndex == 1) { ...

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Why in the world am I getting this error? The solutions I have seen either don't apply or don't work.  Here is my master page code:<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %> <%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %> <%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <asp:ContentPlaceHolder id="head" runat="server"></asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> <DIV class="user" id="userName" runat="server"><usercontrol:username id="userNameDsp" runat="server"></usercontrol:username></DIV> <DIV class="search" id="search" runat="server"><usercontrol:search id="pageSea...

ERROR Content controls have to be top-level controls in a content page or a nested master page that references a master page.
This all used to work until about 5 minutes ago. Did I change something? For some reason I am now getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page. What I have:  I have a masterpage inside of a directory. That directory is a first level directory with its own web.config file....The whole thing is protected by the web.config file above it (in the main public directory). That main public directory has a masterpage as well. I am not currently linking the two masterpages together becuase...

Error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.
when I make a directory on my root, and in that directory I put a masterpage and a web form ... I get always an error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.   Does somebody know what the problem is ? Is it possible you can't set a masterpage in a directory ... ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) i've founded ... I had to nest my masterpage ...Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri Pansaerts, I am receiving the same error as the one posted her...

CS0012 when referencing controls on master page's master page.
 I'm working with a content page that has a master page (we'll call it ChildMaster). ChildMaster also has a master page (ParentMaster). There is a control on ParentMaster I need to access from the content page. The code looks like this:  ControlType controlInstance = (ControlType) Master.Master.FindControl("controlID");  When I upload, I get CS0012 telling me that ParentMaster is defined in an assembly that is not referenced, and I need to add a reference to some assembly with a funky random-looking name (which changes when I reupload ParentMaster). Up t...

How could a master page control call a content page's function?
Dear all: For example: 1. In master page, place a button named "button1" . 2. Add three content page, ( add some code )3. Run application, in content page 1, click button1, show "this is page1",  in content page2, click button1, show "this is page2", and so on . Besides, these code should be in every content page instead of in master page, because actually action should be very complex, master can't predict everything. Is this possible?  Thanks!  Here's a great tutorial that may get you started: Creating a Common Toolbar in ASP.NET ...

How do i get master page's Controls value into Content page!!!
  Hi to All,   I have a Master Page that Contains 4 dropdown lists and 2 Checkboxlists(that contains lot of check box list items) and one Search Button. now i want to search according to master page's controls parameters and display it on content page.now my problem is how do i get the master page's controls(dropdown lists,Checkboxlists)  values into content page. i did use properties for that in master page and calling these properties in  content page like this: Master.master:public string RegionState { get {if (Session["regionState"] == nu...

synchronizing content pages to master page when master page is edited
 Hi Guys,I'm new to designing websites so please forgive this basic question.I've updated my master page and the modfications ( adding a couple of extra place holders)  are not reflecting in the content pages.Is there any way we can update the content pages created before the changes to the master page were made.Thanks a lot  :)  abhinaynag: I'm new to designing websites so please forgive this basic question. I've updated my master page and the modfications ( adding a couple of extra place holders)  are not reflecting in the content pages. Is t...

How can I access the property a control on a master page from the master page's code behind.
On my master page I have a label. I want to change this label's text property based on an element of the querystring. (label.text = "NewValue")All child pages using this master will display the same thing so I was trying to put the code in the master page so as not to have to duplicate it for the child pages or put it in a base class and use FindControl.Is it possible to access from a master page's codebehind the property of a server control that is placed on a master page's aspx? If so how?(I saw similar questions, but they all came from the view of a child accessing the property.)Thank you...

passing querystring from user control to master page's content page
Hi all,        I have a master page which contains two linkbuttons. I want that when user clicks first link button then querystring value is passed to content page's Initialize culture method. how can i do this. English | Spanish < - user control link Master page contains this user control Default page's initializeCulture method need to know which link is clicked and then set culture according.  code inside initializeculute is like thisif (Request.QueryString["Culture"] == null) {Culture = "en-US"; } else {Culture =...

Accessing a master page's control in a nested content Page(Urgent)
Hi all, I have a masterpage rm_master.masterand another masterpage rm_sub.master which inherits from rm_master.master. Now I want to access a dropdownlist control in a content page which derieves from rm_select_master. the code i used wasDropDownList DropDownList1 = (DropDownList)Master.FindControl("DropDownList1");string a; a = DropDownList1.Text;   The error i got was "Object reference not set to an instance of an object". Please help.. Thanks in advance.. Bharath You can try Page.FindControl or use the mastertype directivePlease remember to click “...

Master page's "Load" event is later than content page's ?
Example:1. Add a label to master page, set its "text" attribute to nothing. 2. In master page's page load event, assign "hello" to label1.text3. In content page's page load event: Response.write (   ctype(master.FindControl("label1"),label).text   )it will be nothing. 4. In content page,  add a button named button1, in button1's click event, copy the upper sentence, it will write "hello". so , master page's load event it later than content page's ?  If I need the result of master page's load ev...

Modifying a Parent Master Page from within a Child (Nested) Master Page's Page Lifecycle Event Handlers
Hello, I am having difficulty modifying a control within a parent master page from within a child master page. Essentially, I am building a custom tab-based navigation system, and depending on the page (or master page, in this case), I want to set the CssClass of a hyperlink in the master page to "selected". When I attempt this within the individual ASPX pages themselves, it works flawlessly, though, seems awfully redundant to rewrite the same code for a handful of pages that will inevitably share the same master page anyway. In stepping through (debugging), it seems that we n...

New at this, help with Master Pages and Content place holder in content pages
Hi folks. Hey, I noticed that if I start off with a Master page and I get it pretty much set up the way I want using mostly layers, etc, with the area  that I want the content to be located to be in the middle of the page, I can't seem to get the content place holder to resize to the size I want.. For instance, to be more clear. I want to be able to have a header, and a stripe down the sides of the page that I can use for menu's and then use the space between the stripes which is going to be like 400 pixels as the content area.. But, I want that content area to be scrollable if ...

Hook up to a control's event located on the Master Page from the Content Page PLEASE HELP
I have a master page with a button, and I what to hook the button click event on the content page I allready tried this example http://fredrik.nsquared2.com/viewpost.aspx?PostID=328&showfeedback=true but in vb it doesn't work. Thank you ALL. Master Page Code: Public Event OnbtnGrava_Click As EventHandler Protected Sub btnGrava_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGrava.Click RaiseEvent OnbtnGrava_Click(sender, e) End Sub Content Page code: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim mpButton ...

How to Get Variables from a Master Page's Master Page
Hello, I have some problems with accessing variables I declared in my Nested Master Page. In my site.master I create an instance of a class I made. app.master uses site.master as its master page and needs to use the class created in site.master. In the same way the aspx files using app.master as their master page need to use the class also. I don't want to create an instance three times so would like to access the instance from the content pages. Does anyone have code fragments of how to do this? Thank you, Skorp Hi Skorp  I think these posts should cover what you need http...

Problem in using validation in Multiple step Wizard in content place holder of master page with scriptmanager and updatepanel definded in Master page.
We have a master page with many content place holders. All placed in ATLAS update panel. In Content page we are using wizard control and we want to do validation on each step of wizard. Problem is that one 1st step is successfully validated and user moves to 2nd step of wizard and after entering data clicks next button. Validation controls used in 1st steps are invoked and causes error.   Master  Page ,,,,,,, <atlas:UpdatePanel ID="AP1" runat="server">        <ContentTemplate>        &nb...

master page button click that save's content from a content page
I have a master page button that when clickced will save some information gathered on the content page.  As part of my content page I have a userControl that save's my session properties from view to view on my contentpage.  I can do a find control on my master page and referance my customer (vsCustomer) however what I want is one of the public properties on this refrerance and for some reason I can't seem to get it.  I did find a example on a directCast that works in development however when I try to compile the project I get an error on the line Dim intOrderID As Int...

Change content pages of Master Page without Master Page posting back?
so Master + content pages seems like exactly what I want except that they are assembled on postbacks. I am trying to make a site where both Master and Content pages have updatepanels, and the site switches content pages (40+ content pages) without the master page refreshing. Master Pages are assembled on postbacks so I don't think simple master page will work without annoying postbacks. I tried an approach where load content pages inside an Iframe, but the content pages take too long to load becuase each content page loads its own scriptmanager. View/Multiview will probably work but dif...

Web page doesn't show master page's contents
 Hi All!I've designed a master page and after that I added a webpage in my project and mentioned its master page at adding time of the web page mean while adding the web page, I checked the "Select master page" check box and then added the web page after specifying the web page but the web page doesn't show any content of the master page. Here is the code of the web page:Start of code________________________________________________________________________<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"...

How to render Content Page in master Page Without Full Page Postback
Hi,     I have Created an Web Application in which i hav one Master Page and  ten Content pages.In the Home page i hav a list of hyperlink buttons (<li>Hyperlink1,Hyperlink2,Hyperlink3</li>),so these hyperlinks actually direct to the content pages. I wanted to know how can i render only the content page without a full page page load again with the master page , with an Ajax effect. Thank u for the help Harsha   hello. well, you can't. i think you should redesign your site so that the content is defined by several web user controls another opti...

Programmatically set a content pages Master page to another Master page which is nested in the original
Hello, I have a set up where I have a main masterpage that I use most of the time but occasionally I need to swtch to another masterpage which is actually nested to the main masterpage. The switch needs to happen between postbacks from one content page to another. The problem I'm having, is that it is giving me an exception that it cannot find the content place holders in in the main master page. I have overriden the OnPreInit event of the content page where I check a session variable to see if I need to load the nested page or the main page. When I try to load the page I am presented ...

HELP..... Master Page Error (The page has controls that require a Master Page, but none is specified.)
Hi, I had almost finished creting my master page to use as a template for all future internal applications.  I had created a template to use in creatign new applications and had sucessfully created a new project based upon the MasterPage template... All was working well when I noticed a small graphic inconsistancy on the MasterPage... I reopened the MasterPage and I got teh above error message... I have looked at the HTML and everything seems to be okay and there including the header lines... <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits=&qu...

Show content in both Master Page ContentPlaceholder AND Content Page Content control
I note that by default or rendering rules, when you add content/controls to the Content Page ASP:Content control matched to a Master Page ContentPlaceholder, any content/controls in the matching Master Page ContentPlaceholder is not displayed. Is there a setting that can be made to merge or show both content/controls in the Master Page ContentPlaceholder and content/controls in the matching Content Page Content control? Thanks         Don't think so. If you specify a content control in your page then whatever is in there displays and anything in the matching contentplaceholder does not display. If you wan tthem both to display why don't you put whatever you currently have in the contentplaceholder on the masterpage directly onto the master page (or into a regular placeholder on the master page if you want to be able to show and hide it based on something going on) and then leave the contentplaceholder empty and that way when your page is rendered you'll always get both sets of content renderd (unless you put the stuff you currently have in the contentplaceholder in a placeholder and set its visibility to false.)  If this post answered your question please remember to 'Mark as Answer'!...

Web resources about - Doing Postback from master page to page in master's content place holder(search page) - asp.net.navigation-controls

Resources last updated: 2/19/2016 9:15:04 AM