.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to make a default Area in MVC2??

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
I have the area Blog with controllers (Post and Blog)i want that when the user acess my site without one area, it should redirect him to the Blog area inthe blog controller and in the index actionif i use:            routes.MapRoute(                "ClearPath",                "",                new {area = "Blog",controller = "Blog", action = "Index" }            );i got one error cause he search the view in the root folder: The view 'Index' or its master was not found. The following locations were searched:~/Views/Blog/Index.aspx~/Views/Blog/Index.ascx~/Views/Shared/Index.aspx~/Views/Shared/Index.ascx

View Complete Post

More Related Resource Links

Html.CheckBoxFor - how can I make checkbox default checked ?

I have:Html.CheckBoxFor(model => model.available) how can I have checkbox default checked ?

How to make my application to be minimized directly to the tray icon area ?

I know its a problem . my program most of the time working in the background so most of the time its going to be in the tray icon area. The thing is i can minimize now my application reagulary and it will drop to the left bottom corner and i see only the top of the window of the application so i can resize it. Or i can turn the taskbar property to true and then it will be minimized to the taskbar in the middle . I tried using hid on the taskbar but then i cant resize it from the tray icon cuz its only hiding it in the taskbar not realy moving it to the tray icon . Is there any way or something to make the application move directly to the tray icon area when im pressing the minimize button "-" on my application ? I know there some programs not many but some that when you press the minimize button its going directly to the tray icon. I wonder how they did it.   Thanks for the help .  danieli

Default "area" in master pages

Is there a way to specify a default area for any content specified in a master page?  I have a global master page and a bunch of user controls (.ascx) with action links defined without regard for 'areas' - is there a way to specify the default area to use when rendering action links and the like? The problem occurs when navigating to an area; all the unspecified master page links do not link back to the default area (in my case the root). I.e., Html.ActionLink("Home", "Index", "Home") renders as "/area/home/index" rather than "/home/index". I'd like this to work for all the links defined in the master page file without needing to specify Html.ActionLink("Home", "Index", "Home"new { area = "" } Thanks in advance, Mike

MVC2: Change the default generated HTML when creating a strongly typed view


Is there any way to change the HTML that is generated by default when you create a strongly typed view in MVC2?

I currently get a structure like this:

            <div class="editor-label">
                <%: Html.LabelFor(model => model.category_id) %>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.category_id) %>
                <%: Html.ValidationMessageFor(model => model.category_id) %>

I want to change it to a structure like this:

                <div><%: Html.ValidationMessageFor(model => model.user_login) %></div>
                <div><%: Html.LabelFor(model => model.user_login) %></div>
                <div><%: Html.TextBoxFor(model => model.user_login) %></div>

Make IIS As default server


Hello all,

I want to know how to make IIS as default web server on machine instaead of built cassini web server..

Thanks in advance.

MVC2: Set default button for 'Enter' Key


I have the following code in a View:


            <% if ( Model.IsLoggedIn != true ) { %>
                <input class="NavButton" type="submit" name="submitButton" value="Previous" /> 
                <input class="NavButton" type="submit" name="submitButton" value="Login" /> 
            <% } %>

How do I set the "Login" button as the default button for when the "Enter" key is clicked on the keyboard?


Thank You ! 

Missing Default.aspx in MVC2 after install of MVC3 RC



After I install MVC3 RC, I then create an MVC2 application for old time sake using VWD2010 but the default.aspx is missing.

I copy-paste the default.aspx and default.vb page from another working MVC2 app and replaced the Inherits value of the default.aspx of the new app (MyAnotherMVC2App).


<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="MyAnotherMVC2App._Default" %>

<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%>

Accessing the default page in localhost works but not in production which doesn't see the MVC default page. Sad

Thank You for any help.


How to make Excel open in application not browser by default


I'm facing a problem here. I tried the to open an excel file (.xls) which was attached in a Calendar Item.

On 1 PC, it opens automatically with the Excel application and thus the user is able to edit and save.
On another PC, it opens in the browser and the user is unable to edit / save the file.

Initially, I tried and thought that it's user rights issue but apparantly, it is not.

How can I make the .xls to open in excel by default? Can someone help me?

Really appreciate the help and answers.


make a default value in contentquery webpart

when retrieving data using content query web part, if no rows are returned i want to type a message that no rows were found, how do i do that
I just want to learn more

Need to make sure area code is in table.

I need to check if area code is there than do nothing else
pad the number with the area code.

There is a new area code being introduce the 431. How should I set this up.

dbo.tblUsers Phone nvarchar(14)
delete #tmp
INSERT INTO #tmp VALUES('(204) 325-4059');
INSERT INTO #tmp VALUES('204-940-1261');

Default ASP.NET Architecture

In providing an architectural approach, some assumptions are made concerning the project goals. These assumptions should be used as a litmus test to determine if the described architecture may be an appropriate fit for your ASP.NET application.

Setting the default start page in godaddy hosting?


 How do you set the start page with godaddy hosting? I can see no way of doing this! You do not seem to have access to the IIS settings that allow you to change it!

MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

default constructor SelectList




dont have a  default constructor

new SelectList() :(

areas mvc2 iis 6.0


hi all,

i have another problem. I am trying to deploy my MVC2 website on iis 6.0. I have added the following to my global.asax:


routes.MapRoute("Default","{controller}.mvc/{action}/{id}", new {controller = "Home", action = "Index", id = UrlParameter.Optional } );

I added the ".mvc" extention because i read that iis 6 needs this. And it works. BUT!! I also use areas, and this is something iis 6 does not understand.

I have the following:
No Areapath: Home.mvc/Index (works fine, no area used)
Areapath: Projects/Overview/Index (does not work!!)

I don't now how to solve this, i hope somebody can help me.




Beginner: this doesn't make sense to me


Do you need and "empty" script tag in the head to run scripts that are in the body?  Also, can you run JQuery scripts if they're in the <head> tag?  The first sample only works if the JQuery script is in the form (and body) tag, not in the head - even if I add $(document).ready(function() { });

This works

<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />
<script type="text/javascript">
<form id="form1" runat="server">
<a href="">Here is a link</a>
<script type="text/javascript">
$('a').click(function () {
alert("you clicked me!");


This doesn't work.  Notice I removed the second <script> tag from the head

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="serve
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend