I am building a .NET MVC app that has a page with a list of delete buttons, one for each item in a list. The problem I'm having is that the foreach variable "item" is not visible inside the LoginView, which results in the following error:
Compiler Error Message: CS0103: The name 'item' does not exist in the current context
Below is a s...
I have an ASP.NET MVC application that utilizes NHiberante and SQL Server 2008 on the backend. There are requirements for sending out both event-driven notifications on a daily/weekly basis AND general notifications on a weekly basis.
Here is an example of how the event-driven workflow needs to work:
Employee(s) create a number of pu...
[TestMethod]
public void Home_Message_Display_Unknown_User_when_coockie_does_not_exist()
{
var context = new Mock<HttpContextBase>();
var request = new Mock<HttpRequestBase>();
context
.Setup(c => c.Request)
.Returns(request.Object);
HomeController controller = new HomeC...
Hi folks,
inside my ASP.NET MVC controller, I've got a method that requires an HttpRequest object. All I have access to is an HttpRequestBase object.
Is there anyway I can somehow convert this?
What can/should I do??
...
Below is my asp mvc view. Note that it has a div which contains a simple form. I am using Html.TextBox() to try to output input elements but nothing is output. The form renders properly but where I expect to see the input tag there is nothing.
I'm sure this is a total beginner mistake but what am I doing wrong?
<%@ Page Language="C#...
I have the override below to do a few things with cookies using the FormsIdentity Object. But when I instantiate a controller on my Unit Testing this method is not triggered. Any ideas how to do this?
protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
base.Initialize(requestContext);
...
I'm using ASP.NET MVC and Azure Table Storage in the local development fabric. My pagination code is very slow when working with a large resultset:
var PageSize = 25;
var qResult2 = from c in svc.CreateQuery<SampleEntity>(sampleTableName)
where c.PartitionKey == "samplestring"
selec...
If you don't know what I'm talking about either go through the tutorial and try to add dependency Injection yourself or try your luck with my explanation of the problem.
Note: This problem isn't within the scope of the original tutorial on ASP.NET. The tutorial only suggests that the patterns used are dependency injection friendly.
The...
I have a menu (jquery-ui accordion with Html.ActionLink as menu options). How can I render a partial view in the main content <div> of the parent view, when selecting a menu option?
I can render the partial view, but not inside the main content <div>. Should I use Html.ActionLink in my menu options?
...
I have an ASP.NET MVC application with a route that allows searching for stuff via /search/<searchterm>.
When I supply "search/abc" it works well, but when I supply "/search/a+b+c" (correctly url encoded) then IIS7 rejects the request with HTTP Error 404.11 (The request filtering module is configured to deny a request that contains a d...
I have several models, for which I want to show some common icons for action links (new, details, edit, delete) and some specific ones for certain models only; these iconlinks must only be showed when the user has permission to perform the action. Permissions are decided by roles, but I'd like to abstract them, so that the explicit neede...
im looking for a captcha control that is designed for asp.net mvc
which one is the easiest to implement?
...
var mockedService = new Mock();
mockedService.Setup(x => x.InterfaceMethod(args)).Returns(value);
_Service = mockedService.Object;
MyController controller =new MyController(_Service);
var result = (ViewResult)controller.Foo();
Now this Foo() Method contains the Following API Call
HttpContext.GetGlobalResourceObject(...,...
Suppose I want to allow to select our entity (from a dropdown, etc) on a page, let's say Product. As a result I may receive this:
public ActionResult SelectedAction(Guid productId)
{
}
But, I want to use model binders power, so instead I write model binder to get my product from repository and instead use
public ActionResult Selected...
I was hoping to create a lightbox/modal dialog for login into my website which is built with asp.net mvc. However the only way i can think of is to put logic into the onClick events for the hyperlinks when linking to restricted sections. I would prefer it so I could still use the Authrisation action filter, and when you click on a link t...
i have:
AlbumsController
PhotoRepository
Index.aspx (view)
inside of Index.aspx, i have a partial view call AlbumControl. I want to update this via ajax and ajaxhelper.
the issue is that i want the ability to do the following:
http://www.mysite.com/Albums
http://www.mysite.com/Albums?FilterTag=Birthdays
when i do this, i get the fo...
I'm experimenting with the MVC beta 2 and have the following method in a controller:
[HttpPost]
public ActionResult Create(Issue issue) {
if(TryUpdateModel(issue, "Model", new [] {"Title", "Description"})) {
ServiceCaller.PutIssue(issue);
return RedirectToAction("Index");
}
return RedirectToAction("Create");
...
I get the following error message when rendering a partial view with a jGrid on.
"Microsoft JScript runtime error: '$.jgrid.defaults' is null or not an object"
I have included the relevant .js files. I am concerned about the following line in jquery.jqGrid.js
var pathtojsfiles = "/Scripts/";
All my .js files are under the scripts fo...
We have been happily using the ASPExpert Menu control at work. Recently I have received the green light to update a portion of the site to use MVC. In doing so, I have to maintain the look and feel of the existing site on to the newer MVC portion of the site... This includes the menu. Unfortunately, it looks like ASPExpert Menu is de...
I have an application I'm working on where I want to loop through some data where a flag in the data is set to 1 or 2 and print it to screen.
The idea I'm working on using is from one of the MVC tutorials:
<ul>
<% For Each m As Movie In ViewData.Model%>
<li><%= m.Title %></li>
<% Next%>
</ul>
But I want to do similar to the abo...