MVC :: Html.ActionLink From Within An Area To A View In The Root Of The Site?

Apr 28, 2010

I know that to use link a view found in one view to one in another, i need to use;

[Code]....

But what if i want to link FROM an area to a view in the root of the site? This view is in the views folder found in the root, NOT in any area.

View 2 Replies


Similar Messages:

MVC :: Actionlink Not Passing Parameter To View In A Different Area?

Jul 1, 2010

i have an actionlink that doesnt seem to work as it should.

i am trying to pass a parameter to a URL that is in a different area and it isnt carrying the parameter.

[Code]....

the link generated is;

localhost/user/vacancy/details

whereas what i want is;

localhost/user/vacancy/details/6

View 3 Replies

Html.ActionLink In Partial View - All The Links Of Articles Lead To The Same Url

Mar 11, 2010

I am using the following code in my master page:

<% Html.RenderAction("RecentArticles","Article"); %>


where the RecentArticles Action (in ArticleController) is :

[ChildActionOnly]
public ActionResult RecentArticles()
{
var viewData = articleRepository.GetRecentArticles(3);
return PartialView(viewData);
}

and the code in my RecentArticles.ascx partial view: <li class="title"><span><%= Html.ActionLink(article.Title, "ViewArticle", new { controller = "Article", id = article.ArticleID, path = article.Path })%></span></li>

The problem is that all the links of the articles (which is built in the partial view) lead to the same url- "~/Article/ViewArticle" . I want each title link to lead to the specific article with the parameters like I'm setting in the partial view.

View 2 Replies

Virtual Directory Root Vs Default Web Site Root

Feb 11, 2011

I am using iis 5.1 in which we have only only one default website, I have two projects v2 and v3 my website points to v2 projects and have some folders images, styles etc now i have a virtual directory under this website that is hosting project v3 and having the same folder hierarchy as v2 in the home page of the both projects i have img src="imagesedlogo.gif" alt="logo"/> but this shows the same image that is in the v2 directory, How can i show different images for both projects. using "" get the root of the web site but how can i get the root of virtual directory under that website

View 2 Replies

MvcContrib - Get Area Into MenuBuilder ActionLink?

Jan 12, 2011

I am using MenuBuilder with code like this:

public static MenuItem MainMenu(UrlHelper url)
{
Menu.DefaultIconDirectory = url.Content("~/Public/Images/");
Menu.DefaultDisabledClass = "disabled";
Menu.DefaultSelectedClass = "current";
return Menu.Begin(
Menu.Items("",
Menu.Action<HomeController>(p => p.Index(), "Home")
),
Menu.Items("",
Menu.Secure<HomeController>(p => p.About(), "About")
),
Menu.Items("",
Menu.Action<RegulationController>(p => p.Index(null), "Compliance")
)/* This is in the Compliance area */
).SetListClass("menu");
}

But I am also using MvcContib Areas and in the code above the final menu item is in an 'Area' called 'Compliance'.

(There are two other areas in the Mvc application and the first in the list of registered areas is called 'Legislation')

What happens is the following:

When a page is rendered (I am using the standard WebFormsViewEngine) the Urls are all rendered using the 'Legislation' area!!?

E.g. http://localhost:1337/Legislation/Home or http://localhost:1337/Legislation/Home/About

and finally http://localhost:1337/Legislation/Regulation

The first two links should not pick up the 'Legislation' area. The last menu item should be in the 'Compliance' area.

How do I prevent the erroneous Area (Legislation) being rendered on the first two links?

How do I get the MenuBuilder markup in the Site.Master to accept an 'area' attribute or get it picked up automatically from the Controller for each link?

View 1 Replies

Visual Studio :: Unable To Publish Files To Root Or Staging Area

May 31, 2010

I am slowly working out the setup issues with Visual Studio 2010 Ultimate on my newly installed Windows 7 Professional Machine. I was running XP and copied most of my files back over using the 'Windows Easy Transfer' tool I used prior to installing (not an upgrade) Windows 7.

When I try to publish my website to wwwroot in 2 ways. When I select 'Delete all existing files prior to publish' I get the following error:

Error deleting file 'about.aspx'. Unable to delete 'about.aspx'. This function is not supported on this system.

When I use 'Replace matching files with local copies' I get this error:

Unable to add 'about.aspx' to the Web site. Unable to add file 'about.aspx'. Access is denied.

View 2 Replies

MVC :: Consuming Mvc Portable Area / Call Embedded Portable Area View From Another Web Project?

Nov 18, 2010

I have created a simple mvc portable area project with a simple view displaying hello world.

In the portable areas project i added the view as embedded resource ,compiled to dll and added the reference

in the consuming web project.

How can i call the embedded portable area view from another web project

View 2 Replies

Html.ActionLink() Gives An Empty Link When Use It Inside Html.RenderAction()?

Feb 18, 2010

I have a Microsoft MVC project with an action "Foo" whose view ("Foo.aspx") contains the lines:

<%= Html.ActionLink("mylinktext1", "bar") %>
<%= Html.ActionLink<MyController>(x => x.Bar(), "mylinktext2") %>

When I hit this from a web browser or load it from an AJAX call, it properly returns:

<a href="/bar">mylinktext1</a>
<a href="/Bar">mylinktext2</a>

But when I call the action from another view like this:

<% Html.RenderAction<MyController>(x => x.Foo()); %>

Then the links are rendered without targets.

<a href="">mylinktext1</a>
<a href="">mylinktext2</a>

Why would this be happening, and how do I work around it?

View 1 Replies

Web Site Deployment / Root Of The Site?

Jan 3, 2010

Is not a lot of fun of yielding much success at the moment.

When I copy my web site on the local machine some of the CSS classes in my themes are not applied. Although not major, I am concerned at what may be causing this.

My real problem is regard the root of the site. On my personal machin, I have set the root of my site using the tilde syntax. However, the root of the web site on my host's ftp site is wwwroot.

Does this mean that I need to change a setting somewhere for the page to be recognised?

View 4 Replies

MVC :: ActionLink To External Site?

Mar 24, 2011

How do you use and Html.ActionLink to go to an external site?

View 9 Replies

Javascript - Html.ActionLink In Html.TreeView?

Dec 18, 2010

Im using the HTML.TreeView to render my code structure like this :
<%= Html.TreeView("CategoryTree",
Model.CategoryList,
l => l.ChildList,
l => l.Name + " / <a id="treeLnk" + l.Id + "" href="JavaScript: OpenAddDialog('" + l.Name + "', " + l.Id + ") " title="Lägg till" >Lägg till</a>" +
" / <a id="treeLnk" + l.Id + "" href="JavaScript: OpenChangeNameDialog('" + l.Name + "', " + l.Id + ") " title="Ändra namn" >Ändra namn</a>" +
" / <a id="treeLnk" + l.Id + "" href="JavaScript: OpenDeleteDialog('" + l.Name + "', " + l.Id + ") " title="Tabort" >Tabort</a>") %>

This work fine, but now I need to include a action that redirects to another controlleraction.

I have tried to ad a Html.ActionLink but this does not work?

View 1 Replies

How To Get Base Url Of Web Site's Root

Apr 4, 2011

I want to completely understand how to use relative and absolute url address in static and dynamic files.~ : / :.. : in a relative URL indicates the parent directory . : efers to the current directory / : always replaces the entire pathname of the base RL// : always replaces everything from the hostname onwardsThis example is easy when you are working without virtual directory. But i am working on virtual directory

View 1 Replies

Running Asp.net Site - Cannot Have Files At Root

Sep 28, 2010

I am a PHP developer and have been asked to make some slight amendments to an ASP.net site. I can make these amendments but the biggest challenge seems to be getting the actual site up and running on my own server! I have a had lots of errors with regards to the paths to files, as the website is linked absolutely to the root folder and on my development server I cannot have the files at the root. I have therefore worked my way through some of the files making the paths relative so I can at least see some of the site running but then I came across this error:

CS0103: The name 'Data' does not exist in the current context
Line 5: protected void Page_Load(object sender, EventArgs args)
Line 6: {
Line 7: rptNews.DataSource = Data.NewsArticle.GetLatestNews(3);
Line 8: rptNews.DataBind();
Line 9: }

I assume this is something to do with data being called from a database. How to get the site and database up and running as I have no idea where to start and feel I am going round in circles.

View 4 Replies

MVC :: Routes Not Working On Site Root?

Jan 27, 2011

On a MVC 3 site I have a area named "CMS" on on CMSAreaRegistration I have:

[Code]....

All the CMS controller are under the namespace Site.CMS.Controllers And in Global.Asax I have:

[Code]....

The CMS routes seem to work as expected. But the following link on my site root:

[Code]....

I tried many options to try to solve it but I always get something wrong.

View 13 Replies

C# - How To Html.ActionLink And HTML As Parameter

Jul 31, 2010

Html.ActionLink("<span class="title">Retry</span><span class="arrow"></span>", "Login", "User")

If I execute above code in ASP.Net MVC 2, I get the following output on my screen:

How do I disable the escaping of the code, so my span is within the ActionLink, and not displayed as output?

I know this is expected behavior, to keep it safe, but I want it to interpret the HTML code I pass as a parameter.

View 4 Replies

Using Html.ActionLink But Not Html Encoding?

Oct 19, 2010

I wish to return the following output

<a href="#"><img src="/images/icons/tick.png" alt="" />More info</a>

If i do the following the content is html encoded.
<%= Html.ActionLink("<img src='/images/icons/tick.png' />More info", "OrderRegion", "Campaign", new {id = Model.Campaign.Id}, null) %>

How can i disable the html encoding?

View 2 Replies

MVC :: FormExtensions Make Wrong Paths When Adding Area To Site

Mar 12, 2010

We have a large mvc2 project and just added an area to it. Now some of the paths in our forms are messed up. We are using Strongly Typed actionlinks and formextensions. Please look at the following demo: [URL] The form on this page is incorrectly submitting to the area. I think it's related to routing or just the way that area's are figured out when it's not specified.

View 5 Replies

How To Use Html.ActionLink()

Dec 18, 2010

I'm pretty new to ASP.Net / MVC 2. Can anyone explain how to use the Html.ActionLink thing? I understand that the first parameter is the displayed text, but for the second one, what is the action name?

View 1 Replies

Configuration :: Site Works At Root Of Domain But Not In A Subfolder?

Mar 26, 2011

So my website works great on my local computer. It also works fine when I use the Copy Web Site feature in Visual Web Developer 2010 Express. But I do not want all of my files and the default.aspx to be sitting at the root of my domain name. I want it to be in a subfolder.

So again, it works fine when it's sitting at www.domainname.com

But when I use my FTP program to move the files to:

www.domainname.com/subfolder/

I get an error when I try to visit the site. It's just a general runtime error and does not display the specific error message. It obviously must have something to do with when I MOVE the files/folders from the root of the domain to the subfolder?

View 2 Replies

MVC :: Possible ActionLink To A Different View / Controller?

May 13, 2010

I have the following code and wanted to know how to use the ActionLink par to to a page with a seperate controller/view and pass the Mode.ProjectId into this other controller/view.

View 4 Replies

MVC :: Can Not Define ActionLink In View?

Dec 30, 2010

i have a view that i need to add the following code to it :-

<%= Ajax.ActionLink( "event",
"Register", "ArticleComment" new { id= Model.article1.Article_ID },
new AjaxOptions { UpdateTargetId="rsvpmsg" }) %>

but it raised a red line under Ajax.ActionLink indicating that it do not contain definition for ActionLink

View 7 Replies

AJAX :: Can Entire Content Area Of Site / Pages Be An Update Panel

Jul 5, 2010

Can the entire content area of a site be an update panel? I like the idea of the header and navigation not blinking when the content page changes.

Can this be done by putting an update panel as the first element of the content pages or having a update panel wrap the content placeholder in the master page?

View 2 Replies

Use An Asp:Button Like An Html.ActionLink?

Jul 4, 2010

I have an ActionLink: <%: Html.ActionLink("MyAction", "MyAction") %> I would like to use a button instead. Something like this: <asp:Button ID="Button1" runat="server" Text="MyAction" /> What do I need to do to make clicking the button perform the same action as clicking the ActionLink?

View 1 Replies

C# - Html ActionLink Isn't Displaying?

Jan 5, 2011

I'm showing a small table with a list of usernames, and I want an ActionLink next to each username to Edit the user on another page.

[code]...

The usernames display correctly, just the link doesn't show up. I'm not sure why it wouldn't throw an error instead.What am I missing here?

View 2 Replies

C# - Webform Routing Home Page In A Folder Like Mvc Rather Than Root Of Site

Aug 18, 2010

I've got webform routing setup on my asp.net webforms 3.5sp1 project. I would like to have the files for the site in a directory called content including the home page as I would like to run multiple sites using the same system. In MVC there is a blank default page and the home page is in a folder called home. I can't seem to replicate this behaviour using web form routing but would like to. The blank page is always hit first. the route handler is hit second - it recognises that the request is for the home page and sets up the routing page but is not used. the route handler code is simple:

public string VirtualPath { get; private set; }
public IHttpHandler GetHttpHandler(RequestContext
requestContext)
{
string file = requestContext.RouteData.GetRequiredString("File");
string id = requestContext.RouteData.GetRequiredString("Id");
string queryString = "?menuid=" + id;
VirtualPath = "~/" + file;
HttpContext.Current.RewritePath(
string.Concat(
VirtualPath,
queryString));
var page = BuildManager.CreateInstanceFromVirtualPath
(VirtualPath, typeof(Page)) as IHttpHandler;
return page;
}
Is there anyway I can do this?
Update
Here is my global.asax route code:
public static void RegisterRoutes(RouteCollection routes)
{
Domain.RepositoryFactory repo = new RepositoryFactory();
foreach (var x in repo.MenuRepository.GetAllEnabledGetMenus())
{
if (string.IsNullOrEmpty(x.Url))
{
//add default
System.Web.Routing.RouteTable.Routes.Add(
new Route("Default.aspx",
new RouteValueDictionary(new { File = x.FileName,
Id = x.Id.ToString() }),
new CoreRouteHandler()));
}
else
{
string url = x.Url;
if(x.Url.StartsWith("/"))
{
url = url.Remove(0, 1);
}
System.Web.Routing.RouteTable.Routes.Add(
new System.Web.Routing.Route(url,
new RouteValueDictionary(new {File = x.FileName,
Id = x.Id.ToString()}),
new CoreRouteHandler()));
}
}
}

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved