i am using the asp.net mvc sample app and have expanded it a bit. I use the asp.net membership for login and registration for users.
I now want to change it so when people register, instead of instantly being able to login, it goes to some state where an admin has to approve it. Once this approval happens, then they can log in.
Is th...
I have a form which is part of a partial view and I need to submit it to a different location based on the context of the view containing the form. I can't use Html.BeginForm because the form has a multipart/form-data enctype so having the action filled in automatically is out the door.
Is there a simple variable I can call to fill in t...
Does anyone know about any articles/examples of using System.AddIn with ASP.NET and/or ASP.NET MVC applications?
I'm looking to use System.AddIn to make an ASP.NET MVC application extensible.
...
Has anybody had luck with this?
Please let me know if I understand it correctly, if I have a simple model let's say with:
public string Name { get; set; }
public string Details { get; set; }
public DateTime? Created { get; set; }
and then I perform a:
var myModel = getCurrentModelFromDb(id);
UpdateModel(myModel, "ModelName", new str...
Hello,
I wondered whether UpdateModel is considered an "expensive" operation (due to Reflection lookup of the model properties), especially when seen in the context of a larger web application (think StackOverflow)?
I don't want to engage in premature optimization but I consider it a design choice to use UpdateModel which is why I'd lik...
So I am following ScottGu's NerdDinner tutorials, and am having some trouble wrapping my head around this error. I am trying to implement CRUD, so at first, while editing data, I started with this code:
public ActionResult Edit(int id)
{
Dinner dinner = dinnerRepository.GetDinner(id);
return View(dinner);
...
Ok, so I want to force https/ssl on parts of my ASP.NET MVC site. Found lots of great sources including an ActionFilter here: http://blog.tylergarlick.com/index.php/2009/07/mvc-redirect-to-http-and-https/
Whenever I enable the ActionFilter however I end up in a redirect loop. The problem is that if I type https://www.mysite.com/ into th...
public ActionResult TestControl()
{
return PartialView();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult TestControl(FormCollection form)
{
if(!IsValid(form))
{
ModelState.AddModelError("_FORM", "Some error");
}
return Redirect(Request.UrlReferrer.AbsoluteU...
Hi, I am trying to create a link, which will onclick change a session variable like this
<a href="/Index" onclick="<% HttpContext.Current.Session["location"] = location;%>" >
<%=location%>
</a>
However, during processing the page the session changes on its own during generating each anchor element (with this onclick attribute). So...
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "My", action = "MyFolder", id = "" } // Parameter defaults
);
The above code will help invoking the view which is in MyFolder action which is in the MyController of the same project.
What if the MyController is in d...
I've build a Custom Action Filter in order to validate Web Service return parameter. If the parameter is not verified the ActionFilter redirect user to the maintenance page.
Here is my Action Filter
public class RequireWSValidation : ActionFilterAttribute
{
public String Controller { get; set; }
public String Action { get; set;...
Is it possible for a ASPX view (in ASP.NET MVC) to have non-default constructor AND use this constructor when creating this view?
Example - Page will inherit from this class:
public class ViewPageWithHelper<TModel> : System.Web.Mvc.ViewPage<TModel> where TModel : class
{
public ViewPageWithHelper(Helpers helpers)
{
...
Greetings.
In attempt to wrap my head around MVC I've just implemented a simple add/delete page which views records as well. This makes it easier for users to do most things from one page instead of having to navigate away to do simple tasks. The page lets you add a record (a business which has an ID and a name) which works fine. How...
I have a controller called Parameters which allows some parameters common to my object model to be edited/viewed. Creating/viewing is performed using a couple of partial views - ShowParameters.ascx and CreateParameters.ascx.
I have a number of other controllers that all use ShowParameters.ascx to show their related Parameters. That work...
Hi,
I have a site that was using ASP.Net MVC Beta 5, and I have just upgraded it to ASP.Net MVC 1.0. I am having trouble with the selected item in a drop down list.
The follow person has a similar question (http://stackoverflow.com/questions/589935/html-dropdownlist-in-asp-net-mvc-rc-refresh-not-pre-selecting-item) but I there is no an...
Does any know or use and good resources for TTD with ASP.NET MVC specifically with Rhino Mocks.
Do you prefer any other Mocking Framework?
My choice on Rhino Mocks is simply because it seems the one which is most up to date and from what I have read is extremely capable!
...
In the Repository there is a GetPagedList method.
I have a method that expects a return of PagedList
I currently have
return _repository.GetPaged(sortBy, pageNumber, 20);
However I now need to do some checking such as
_repository.GetPaged(sortBy, pageNumber, 20).Where(x => x.IsAdmin == false)
This now changes type to IEnumera...
Hi All
I am about to make a web application that should contain grids with huge portions of data, where speed is of the essence (filtering, sorting, editing...), and the client wants it made with Silverlight controls;
So, my question is, which path should I choose:
make it in Silverlight from scratch, or
combine ASP.NET MVC project w...
Maybe I'm complicating this but you will enlight me for sure.
Imagine a page where a list is displayed. That list is paged.
I specify the list displays 30 items, therefore the controller returns my 30 items and the view renders the 30 items.
My question is: both the controller and the view need to know the 30 setting. Where should it be...
I would like to use [Authorize(Roles="Admin")] tags on my controller methods.
If a user is not an admin I would like to return this user to my login screen.
The default behaviour of returning the user to my login page is reroute my user to "Account/Login" using a Get url.
The problem is, my website's subpages are all partial views refr...