load a page with AJAX in a jQuery UI dialog without iframe - c#

load a page with AJAX in a jQuery UI dialog without iframe

Actually you can get the output of an ASP.NET page via ajax and place it in jQuery UI dialog but I wouldn't consider it loading an ASP.NET page in the scrict sense as no postback/callback would ever work.

First, do your AJAX request to get the page, then put the contents in an element, then instantiate the dialog:
$.get('YourPage.aspx', function(html) {
$('div').html(html).dialog();
});

Related

How can I programmatically confirm a form resubmission in a web browser?

I have a WebBrowser on my form and once the page is loaded and some content is extracted, I call Refresh() method but I'm getting this error from page:
How can I confirm this resubmission automatically and programmatically?
Note on buttons' text translation:
Repetir = Repeat
Cancelar = Cancel
If it's an option, try doing an AJAX post and checking on the response.
Could you simply change the URL in the WebBrowser to the same page, rather than refreshing?
If all you are doing is trying to load content, rather than actually displaying something - you could try Watin. http://watin.org/

how to show two web pages in one window without frames

I want to show a web page within another web web in asp.net. I have a page named home.aspx and a page name add.aspx how can i do this.
if you just want to load contenct than make use of jquery ajax function or noraml ajax to load data in you page
Example
$("#result").load("AjaxPages/Page.aspx", function () {
alert("Page.html has been loaded successfully!")
});
Use iframes. Pleace for example this code inside the homep.aspx. This is only the idea, find how to show it with out border and with out scrool bars, and also how to fit it in place.
<iframe src="add.aspx"></iframe>
http://www.w3schools.com/tags/tag_iframe.asp
http://htmlhelp.com/reference/html40/special/iframe.html
ajax and iframe
Use ajax if you have some informations only to show. Use iframe if you also need independend post backs that enters data.
ajax is better if you care to have only one page, not working with out javascript, and maybe you need to add more ajax to make more thinks with the data that you get.
iframe is fast, but 'dirty' because is not seo friendly, a user can open content from iframe alone, etc.

How do I change the view behind the popup after an ajax post?

I have an "Edit Profile" lightbox on my page, which posts to the controller via jQuery ajax. I handle the response in the jquery end instead of returning a View. However, when the profile is saved, I need to refresh the values on the page displaying the popup. How could I achieve this in MVC2? For example, if the user changes her name and avatar (in the lightbox), after she saves the profile, I'd like to update the avatar and name everywhere it occurs on the page.
Well what i would be doing is make your Controller return a PartialViewResult, which the end result is basically HTML.
The Partial View would be the popup itself, so essentially your calling your Controller method via AJAX, doing your server-side work, then re-rendering the Partial View to the client.
Have the action you post to via jQuery return a success for failure message. If it is a success, change the avatar/name/etc on the page using the values already in the textboxes (i.e.: the values you posted to the controller). If it is a failure message, display the validation errors.
In your jQuery AJAX, everything can be done in the callback function of the AJAX request.
Prabhu - both your profile page (i.e. the 'main' div contained within it) and the popup div should be partialviews. on posting the popup back to the server, you should requery the main page partialview and return the appropriate html, targetting the 'main' div.
that's certainly the approach that i take for a very similar task.

How to re-input an AJAX request on press back button in the browser?

I have a search that returns an AJAX(MVC AJAX Form) grid, and, in the grid there is a "details" button. When I press "back" I want to return the page with the returned results(that are loaded via AJAX after the page has open).
How can I do that? Using ASP.NET MVC AJAX or Jquery?
You may need a back button plug-in for jQuery.

Refresh only the content panel in master page on page navigation in asp.net mvc

I have a master page with Header, Menu, Content and Footer panes in my asp.net mvc (C#) application.
I don't want the Header and Footer panes to refresh on each page navigation, only the Menu and Content panes should get refreshed.
How can i achieve it in the asp.net mvc application? any suggestions
A pure ajax load of the inside of the pages could be achieved by capturing link clicks in the navigation to something like:
$('a:not(.external)').each(function(){
$(this).attr('href', '#'+this.href);
});
Then you could use the jQuery BBQ plugin to manage your back button and page loads with the 'onHashChange' event. This will allow you to ajax load each of the main portions of the page (likely with a $('#main-div').load(url); type call). The demo for BBQ does pretty much exactly what you'd like, with the added benefit that you don't ruin the back button, so I would suggest taking a hard look at that.
Make Ajax calls to the controller, like below and create the "*.ascx" PartialView you need
$('#divMainContent').load("./LoadMainContent");
[Authorize]
public ActionResult LoadMainContent()
{
return PartialView("MainContent", sp);
}

Categories

Resources