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.
Related
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.
I am pretty new to ASP.NET programming. Now I try to add several web user controls to my page dependent on checked boxes in a tree view that I create from data of my database.
I was thinking about using iframes - one for the tree view and the other one for the controls, but this seems quite complicated. Is there an easier way to do this?
The tree view should always remain on the page an the web user controls should appear or disappear in a scrollable part of the page. Could you tell me what would be good practice to resolve this issue?
iframes would not be the easiest way to go about this (as you have two different server side pages that cannot communicate with each other).
If the number of controls that you are controlling visibilty for is not large, I would suggest that you have your user controls in a panel on the page, all invisible, and the treeview and this panel all on the page, within an update panel.
On check of the treeview, in the partial postback, show/hide the appropriate web user control.
As noted above, dynamically adding controls is problematic, as they have to be re-added every postback and you run into state issues.
Dynamic controls added to the page need to be added back to the page on every postback. I would not use iframes for this; instead, you can have the tree view on the left in a floating div, and another floating div for the right content. If the right content is always checkboxes, use a ListView, Repeater, or some other data bound control that builds the control tree for you. It's much easier to work with these controls as long as the UI is consistent. If not, you can build the right side dynamically. You'd have to readd the checkboxes to the page on all future postbacks.
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.
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
in my ajaxified page i have used several user control shifting from one user control to anothe r and then pressing the back button takes me to first page instead of previously filtered page
how to solve this
all this filters are linkbuttons i am also using listview these filters are actually filtering the content of this listview
You may take a look at the jquery history plugin. If you are using UpdatePanel to perform the AJAX requests you might find this article helpful as well as this video.