1 Attachment(s)
Add a TabPanel on a Nested Page from a Master Page
Hello All,
I have just discovered ASP.NET and, with the help of this board, have been making some great leaps in the last month or so with conceptualizing the framework. I come from a windows dev environment so the web makes me feel like a big dummy. :D
I am using VS2008, VB.NET, 3.5 Framework, ASP.NET, AjaxControlToolkit.
I have included a screen shot that might help to look at while you read my attempt to explain my issue below! :)
So please bare with me, but I just recently discovered in a book here on my desk how to interact with a master page programmatically from a nested master page or a regular aspx child page. The method they describe makes sense and is familar to me because they use Public Properties on the master page to manipulate the GUI and controls on the master page. But since they are public, the child pages can see them and fire them off. Makes sense.
I thought I could use this method to do the opposite of that and have the master page fire off something (say a public property in a nested page) to have it then do some work and update things on that nested page.
For example,
I have a MASTERPAGE.MASTER. Under that, I have a LEFTNAV.MASTER (so its a nested master page). Then, under that I have my default.aspx page.
(I did that so that for some of my regular aspx pages I could just tie them directly to the master page so that they dont have a left navigation page...like for big charts or graphs, etc. Is that the best way for that by the way?)
So on the masterpage, I have just a simple asp.net search textbox and an asp.net search button. When they type something in and click search, I want it to add a tab to the AJAXControlToolkit - TabPanel that I have on the default.aspx page, then some other things such as update a datagridview there with the search results.
I can do all of this except the event firing and scope. I cannot see a way to make a button on the master page up top fire off an event that is on the default.aspx page to make it do what it needs to do.
What I tried doing was creating a public property on my default.aspx page. I have some actual code in the SET to do some GUI manipulation and change some stuff on the page. But on my master page within the search button's click event, I cannot see where to call this public property on the default.aspx page...
Am I WAYYYYY wrong on this?
Thanks for any feedback.
Re: Add a TabPanel on a Nested Page from a Master Page
Hey,
In my opinion, the Master Page shouldn't interact with the Content Page as you are describing, there is really no need for this to happen.
Instead, you might want to think about passing parameters into the content page via query string parameters, session parameters etc.
That way, on the load event of the content page, inspect these parameters, and then take the necessary action to create the required tabs.
Does that make sense.
Gary
Re: Add a TabPanel on a Nested Page from a Master Page
Thanks Gary for chiming in! Long time no see. :)
Quote:
via query string parameters, session parameters etc.
I guess that part throws me a little bit as I have yet to work with any session state variables, cookies, or anything that passes data around or stores data in the app yet...
[timelapse, fast forward]
OK, so I just went out on the net and have been looking into the Session("") stuff and I cannot believe I did not know about it beforehand. I've got it now sending search paramaters to my default.aspx page from the masterpage.master.
The only thing I don't like too much that I cannot seem to find much on so far is the fact that it refreshes the whole page. Know of a way to have a Redirect target just a <DIV> on a page?
Or, perhaps is there a way in ASP.NET or just HTML to embed an actual .aspx page within smaller target? Or would I have to make what is my default.aspx page (in the pic above) into a masterpage and have a content template within there that just houses the tabs in their own aspx page?
Or, further yet still, would I be able to add a second content template to my LeftNav or MasterPage (in the pic above) to house just the tabs and still have the other content of the page all around that? It seems like I have seen examples where there are more than one content template in master pages... not sure.
Re: Add a TabPanel on a Nested Page from a Master Page
Hey,
It sounds like what you might be after is an AJAX UpdatePanel:
http://www.asp.net/Ajax/Documentatio...datePanel.aspx
This does a partial post back to the server, so it won't do a full page refresh.
Gary
Re: Add a TabPanel on a Nested Page from a Master Page
You're going to make it unnecessarily complicated for yourself if you use a session or updatepanel. Part of the problem is that you've got the search box in the master, but the search results in the content page. You therefore shouldn't have an UpdatePanel spanning the button to the tabs, as that would encapsulate too much. A session would involve a postback anyways so you may as well go querystring. Is the postback really such a big deal, keeping in mind that you can't have a web app behave just like a windows form app? It's one of the most common things on the web. I'm about to click 'post quick reply' and it's going to do a post. When you do a search just about anywhere, there's a post/refresh.
Re: Add a TabPanel on a Nested Page from a Master Page
mendhak, you may be right, I guess, the more I think about it. Perhaps I am just seeing it from a different perspective since I haven't completed it yet.
I just now was able to get back to this project as all the fire drills at work took my time, but I will let you know how it goes when I complete an example that just does a page refresh.
Then, after I get it working, I will tweak it and see how I can optimize everything.
Thanks for the advice, guys!
Re: Add a TabPanel on a Nested Page from a Master Page
Alright, post if you get stuck, we're always happy to help.