I added the AuthorizeAttribute to secure my ActionResult.
[Authorize(Roles = "MyUser, Admin")]
public ActionResult Index()
{
var allData = myDataRepository.FindAllData();
return View(allData);
}
The Index view displays a list of data from my table. I want to show 1 row is the user Role is MyUser and all row...
AJAX newbie here!
At the moment in my ASP.NET MVC web app my AJAX requests appear to be getting batched or queued, im not sure.
No requests seem to be getting completed until the previous request has finished.
How do I go about getting the requests to return independantly?
I dont necessarily want someone to give me the answer but maybe s...
I'm struggling to find the best way to display validation messages after a form which has been generated via ajax is submitted.
Let me explain better:
I've got a page that starts with a few options. Based on what the user selects from dropdowns and by adding new fields, the form is created and at the end the form is submitted.
The probl...
I'm trying to set up blade unit tests in an MVC Turbine-derived site. The problem is that I can't seem to mock the IServiceLocator interface without hitting the following exception:
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at System.Reflection.E...
I have implemented the Ajax Autocomplete feature in my application using a web service file that querys my database and it works great. One problem I am having is allowing the user to see the item's name, as that's what they are typing in the textbox, but when they select it, it saves the item's ID number instead of the actual name. I ...
Hello,
I want to Unit-test a method like the following:
public ActionResult StoreFile(FormCollection form, string _paginaAtual)
{
Session["MySession"] = 1
if (Request.Files["uploadedFiles"] != null)
{
//do something about the file
}
return View()
}
It's inside my "SomeController.cs" contr...
When using a Html.EditorFor and passing in my ViewModel is it possible to not have each individual form element display their error message.
I'm using the validation summary and as such the error messages are showing up twice. Once for the form element and then again in the summary.
...
Hi There!
I´m newer user in stack overflow and my english i´snt so good i hope you understand my trouble.
when I´m compiling my template this archives .cs it´s ok (Context, Structs), but in the ActiveRecord the code comes incomplete.
It seems that the system Break de compilation at line 5017 and not return any exceptions to me.
my c...
I want to add Html controls in runtime using Microsoft MVC2 RC2 to create a dynamic data entry form.
(Preferably also supporting the UIHint feature)
What is the recommended way of doing this?
Best Regards,
Rune
...
Hi,
Is there an out-of-the-box way to create unique "id" tags in ASP.NET MVC?
(Similar to the dreaded but sometimes useful ClientIDs in WebForms?)
This would be useful when rendering a partial view many times on a page.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%-- Example Partial View --%>
<div id="<%=...
I am using the MvcContrib library with Castle Windsor and I am having a problem
with setting a parameter when I register a component.
I have the following interfaces for classes that wrap a DataContext. I want
to be able to specify which DataContext to use for different services because
I am connecting to several databases to retrieve ...
Ok. This one must be silly: We have just migrated a project to Visual Studio 2010 (Release Candidate) + .Net 4 + MVC2. One of the reasons was that the customer has record IDs that include the "/" character, and using encoded slashes as route parameters was not allowed until .Net 4.
(See http://stackoverflow.com/questions/591694/url-enco...
Hi All
I have a view that contains 2 list boxes: Audience & Locale
I'm trying to submit a form that contains the selected index of both to my controller, which has an action method of this signature:
public JsonResult Submit(Audience aud, Locale loc)
{
// do stuff
}
The problem I'm having is both Audience & Locale have an ID propert...
Hi!
I'm a newbie with ASP.NET MVC and trying to bind a Drop Down List with a data from a database. I'm making a computer packet calculator application, basically the users can select components he/she wants into his/her computer packet from a drop down list and then send the order into a email. The components must come from a database.
...
Hello, I'm new to EF and I've been using the asp.net mvc databind method to update my models "tryupdatemodel", now I have to update a entity from a service layer, since TryUpdateModel is a asp.net mvc method I can't use it in the services layer.
What I need to do to update the data of an entity without using this method?
I'm using repo...
So far I still have the standard routing. What I tried to do is
public Foo : Controller
{
public ActionResult Index(int id)
{
return View("List", repo.GetForId(id));
}
public ActionResult Index()
{
return View("List", repo.GetAll());
}
}
The URL I entered was
localhost/Foo/Index.
I was un...
I'm creating a custom MembershipProvider for an ASP.NET MVC website, and I was planning on using LINQ to SQL for the internals, as I am for the rest of the website. Are there any issues with this, specifically any security issues it causes?
...
First, I use C# 4.0 and EF 4.0 with POCO object to access database. Next, I create some grid (like jqGrid) for displaying data from database via ASP.NET MVC 2.0. This grid can order data by clicking at the column header. Source code could look like this.
// This method will generate data for jqGrid request.
// jqGridRequest contain seve...
Hi All,
I am using Http Handler ashx file for showing the images.
I was using Session object to get image and return in the response
Now problem is i need to use custom Session object its nothing but the Wrapper on HttpSession State But when i am trying to get existing custom session object its creating new ...
its not showing sess...
I am trying to create a custom authentication scheme in ASP.NET MVC using form authentication. The idea that I might have different areas on the site that will be managed - approver are and general user area, and these will use different login pages, and so forth. So this is what I want to happen.
User access restricted page (right now...