How to load aspx inside content or update panel - asp.net

Sorry for this pretty simple question: I have a Master Page with a menu located at left, and an update panel inside a ContentPlaceHolder located at right.
When I click a menu item, and use NavigateUrl property, it loades a page in the whole browser screen. How can I make it loades inside a certain region, in this case the update panel?
Thanks in advance

The quick and dirty answer is to use an iframe.
I personally am not a big fan of iframes and would recommend that if you are truly looking for a "load in place" type solution that you research a more client-side solution than ASP.NET WebForms using UpdatePanels, such as jQuery/AJAX/Templating, KnockoutJS, BackboneJS, AngularJS or Ember.js.

As a different option you can convert the aspx page into a UserControl. Then you can load the UserControl in the update panel.
If you also want to have an aspx page you can create a different aspx page that contains that same UserControl.

Related

.net page design with complicated Ajax relationship

I am creating a .net website in c#.
The master page contains a fixed footer bar from which you can display 'bookmarks'. I also have a remove function for each bookmark.
Some aspx pages may have a add bookmark/remove bookmark function (a button control) on them.
I use update panels throughout so button controls are always encapsulated by one.
If I add/remove a bookmark from an aspx page, I can trigger an update to the fixed footer panel. A delegate event is triggered in the aspx page which calls a method on the master page to update the fixed footer panel, so everything is sync'd dynamically.
It doesn't seem possible to do the same the other way around. If i remove a bookmark from the fixed footer, I would need to know if the current aspx page was displaying a bookmark control. Pretty much impossible I would have thought, but I'm open to suggestions.
With that in mind the question really is does anyone have a technique that they use to deal with these scenarios, such as calling a full page update or something similar, or is it a case of doing nothing until the next page load/postback?
Thanks in advance.

Open aspx page in modal popup

I have an aspx page (let say page1.aspx) having labels and buttons on it. In some other page i need to show content of page1.aspx in modal popup. I have read many articles, but did't find exact solution. Some of the possible ideas are, 1: create Usercontrol, 2: Use Server.execute() method.
Please suggest any solution. Thanks
If you simply want to show a popup (a modal dialog) you can create an user control which contains the markup form page1.aspx and use either AjaxControlTookit (ModalPopup) or jQuery.dialog
I prefer the jQuery.Dialog, it saves 2 postbacks to the server and is easier to integrate.
Here is how to integrate it with ASP .Net, a little trick so the inputs inside that dialog will be posted to server, when the button is clicked.

how to call a modalpopupextender from any page asp.net

How do you call a modalpopupextender(dialog panel) from any web page in the application with asp.net. lets say i have an email button on several pages and want to call the emailpopupextender. how would i do that?
For those having a similar issue here is a good tutorial for the user_control method of ModelPopupExtender How To: ModalPopupExtender as UserControl
Note: From what I've experienced, trying to call MPE in MasterPage from a page in an IFrame doesn't work. If someone has an idea of how to do please post comment or answer.
If you put your popup extender and all supporting stuff within your MasterPage you could then call it from any page that was rendered as the items would already be there.
If you don't want to do a Master Page solution you could create a UserControl for the process and include that on all pages.

Button, UpdatePanel and MasterPage

I have asp.net application and a TabContainer from AjaxControlToolkit on a form. There are 4 tabs, each containing UpdatePanel, hidden button and some custom .ascx (each with it's own javascript file). Buttons are triggers for panels to update the contents and they are triggered from the 'OnClientActiveTabChanged' event of the TabContainer.
This technique is described here and similiar here. It's pretty simple when looking at it.
The only problem I have is that the whole scenario works when used as a separate page but it doesn't seem to work when masterpage is around that page. Suddenly buttons act as full postback controls.
Do you have any idea what's the reason?
Assuming the buttons your referring to are on the master page, I think you'll want to register the master page buttons as update panel triggers.
http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers

Collapsible panel inside GridView

I'm developing an ASP.NET 3.5 web application using C# with AjaxToolkKit. I have a following question.
How can I put a collapsible panel inside GridView to make a master and detail list that expands to display the detail panel when view link in a row is clicked? This is something similar to the download list in MSDN page.
Thanks
Implement jQuery on the page. Have a look at the ajax methods, specifically in your case the load method. Show the master record on the page, along with a hidden div (you could inject it, but hey lets keep this simple ;). Bind the load to the click event of the master record displayed, and then use slideDown to show the hidden div on the page.
ie A very simply example of the load method, loading the html result from ajax/test.html into the element that is selected by 'result'
$('#result').load('ajax/test.html');

Resources