How to call a normal html page from mvc3 - asp.net-mvc-3

I want to call a html page on click of a button in mvc.
Is there any way to call a normal html page from mvc3?

Use an anchor tag in your view, as you usually would:
Click Me

Then your button should look like:
Click me

Related

Remain within magnific popup

I have an ajax popup working nicely with Magnific Popup. However the page that I am loading into the popup via the ajax call contains a hyperlink.
The only contents of the page is:
test
When I click on the "test" link "anotherpage.html" loads in the original parent window.
Is it possible for the page that this link points to to be loaded in the same popup window?
you can achive this effect by following these steps:
download the html page with jQuery into a temporay variable
from the variable get the link address
send Magnific Popup the link you want to display in the first place
for the first part, you can you this great post on stackoverflow: How do I load html into a variable with jquery
for the second task, all you need is to query the first (and only) link in your html page and get it's href attribute:
var target = $('a:eq(0)').attr('href');
now that 'target' variable stores the requested url - send it over to Magnific Popup
include a empty iframe in the popup.
create a function onclick in Test for change the src of iframe and hide or destroy the old thinks in the popup,

ASP .NET MVC3 Razor Popup View

I am new to web development..
i have created views using Entity Framework in MVC3 Razor..
What i have done yet is,
i 1st created model(Clients) and DbContext(ClientDbContext) Classes.
then, i add controller with scaffolfind options
Template: Controller with read/Write actions and View, Using Entity Framework
Model Class: Clients
Data Context Class : ClientDbContext
Views : Razor(CSHTML)
It Creates the controller class and index, Detail, Delete, Delete Views...
After that i modified the index page for search and pagination...
All are working good...
in the index page i have create, edit, delete, detail links...
When i click the links browser loads to that page and working good...
But i need to popup those views when i click the links in the index page...
i don't know how to do this... i studied many articles but i am confused...
Please help me to solve this with an efficient manner...
Thanks in advance...
Creating a model pop-up within a page isn't something that can be done directly with ASP.NET MVC. You could do it yourself using javascript & css but I would strongly recommend using a JS UI framework to do this. jQuery UI has a pop-up modal box, except they call it a dialog.
The docs for jQuery UI's dialog can be found here. Have a look through the examples to see the fine details of how to set it up. But this is the basic flow of what you need to do:
Download the jQuery UI files needed and include them on your page (CSS/JS files)
Take the html from your create/update/delete views and put it on your index page, wrap them in a div with an appropriate id
When the page loads use jquery ui to target your div's you want to be a popup
Things such as the link you want to make a dialog popup is set by passing options to the dialog initialize method, again the exact options and examples can be found on the docs page.
Refer this : http://jqueryui.com/dialog/ to create a jQuery Dialog box.
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
<div id="dialog">
#using(Html.BeginForm()){
#Html.EditorForModel()
<input type='submit' value ='Submit'/>
}
</div>

Kendo Modal Window ViewModel

I have created a page Main.html in witch there is a ViewModel.
In this page there is a button that open a Window Modal and load in it a html page in ajax.
I want to use the viewmodel of the main.html in my window modal, but if I call the viewmodel it do error..
Does someone know how can I resolve?
Load a partial view in to your modal and make sure it has the proper using statement to allow it to use your model:
#using YourApp.YourModels.TheModel

asp:menu functionality in asp.net mvc3

how to use aspx menu functionality in ASP.NET MVC3. So that clicking on the menu item will poplulate the gridview.
ASP.NET MVC Does not have any Server controls like what we have in ASP.NET WebForms. It is all about writing pure HTML code by hand. ( All the server controls in Webforms also generates HTML and render to browser)
What you can do is, Have a tags for your menu item. Then on click, you can call another action method which loads all the data you want to show in the tabular format. If these menus are going to be in all pages, you can keep them inside the _layout.cshtml which will act like a Master page.
IF you want to load some data to the Table(UI) without a page reload, you can do it with jQuery ajax.
Assuming you have some markuplike this for your Menu, The below code loads response from your Action methods using the jQuery load function.
//Don't forget to include jQuery library
<ul>
<li>#Html.ActionLink("Users","List","Users",null,new {#class="ajaXMenu"})</li>
<li>#Html.ActionLink("Jobs","List","Jobs",null,new {#class="ajaXMenu"})</li>
</ul>
<div id="contentDiv"></div>
<script type="text/javascript>
$(function(){
$("a.ajaXMenu").click(function(e){
e.preventDefault();
$("#contentDiv").load($(this).attr("href"));
});
});
</script>
first you'll probably want to look into something like sitemaps for MVC, which there is a really good open source option:
https://github.com/maartenba/MvcSiteMapProvider
Then you'll want the actual menu. There is no MVC menu control, so you'll have to either create one yourself, or use someone else's. Twitter bootstrap has a nav menu that is fairly good:
http://twitter.github.com/bootstrap/components.html#navbar
Additionally, telerik has a menu that you can use as well, but this one you need a license for:
http://demos.kendoui.com/web/menu/index.html

ajax aspx example

Can anyone provide a simple use of AJAX in a vb aspx page, so I can just reload a part of the page and not have to reload the entire web page?
UpdatePanel example from MSDN would be my suggestion for what you want.

Resources