asp.net-mvc

Problem setting up T4MVC and MVC 2

I'm setting up T4MVC for MVC 2 on my website. I get 2 build errors: No overload for method 'RenderAction' takes 3 arguments in T4MVC.cs and No overload for method 'Action' takes 3 arguments in T4MVC.cs These are the ones in the T4MVC.cs file: public static void RenderAction(this HtmlHelper htmlHelper, ActionResult result) { ...

Problem showing modelstate errors while using RenderPartialToString

Im using the following code: public string RenderPartialToString(ControllerContext context, string partialViewName, ViewDataDictionary viewData, TempDataDictionary tempData) { ViewEngineResult result = ViewEngines.Engines.FindPartialView(context, partialViewName); if (result.View != null) { Strin...

MVC Dropdown List isn't binding to the model.

Hi, I am trying set up a simple dropdown list but I dont seem to be able to get it to bind to the Model. I am using Asp.Net MVC and nhibernate. My dropdown list is declared like so: <%= Html.DropDownListFor(model => model.Project, (IEnumerable<SelectListItem>)ViewData["Projects"], " -- Select -- ", new { name = "Project" })%> I set ...

Windows Identity Foundation sample MVC application

Is there a sample application for using WIF with a ASP.NET MVC application? Can someone help me get started trying to integrate both of these technologies? ...

ASP.Net MVC null reference exception with TextArea name

Hello, I have a TextArea html helper method I'm calling in a foreach loop. Basically, when I initially load the View it works fine, but when i reload the View and load postback data, the same TextArea throws a NullReferencException and yet the variable I'm using in the TextArea as the name of the TextArea is not null. I've attached a p...

Updating an object with L2S with ASP.NET MVC

Is there an easier way to update an object with L2S other then doing it property by property? This is what I am doing now: Public ActionResult Edit(Object obj) { var objToUpdate = _repository.Single<Object>(o => o.id = obj.id); objToUpdate.Prop1 = obj.Prob1; objToUpdate.Prop2 = obj.Prop2; ... _repository.SubmitCh...

autopostback for dropdownlist in mvc.net

how to set autopostback for dropdownlist in mvc.net? ...

Do I really need an ORM?

We're about to begin development on a mid-size ASP.Net MVC 2 web site. For a typical page, we grab data and throw it up on the web page, i.e. there is not much pre-processing of the data before it is sent to the UI. We're now making the decision whether or not to use an ORM and if yes, which one. We had been looking at EF2 AKA EF4 (...

file input - prevent selection of certain types of files and size

Is there a way to prevent the user from selecting a file that is not a specified file type when they browser for the file on their computer? For example, when a user browseses to upload an image file I would for them to only see images (jpg, png, ect.) that are less than 20mb. Is this something that can be accomplished with asp.net mvc...

ASP MVC Sitemap with MvcSiteMap

MvcSiteMap - http://mvcsitemap.codeplex.com/ Is it possible to create such links in a sitemap with MvcSitemap? I can create a simple sitemap but not one with the link below.. www. ... .com / Eventname / groupID /Tasks/ Details/ taskID Eventname, groupID, TaskID are dynamic. If not is there another solution for my problem? TY in adv...

asp.net mvc routing id parameter

Hi Experts, I am working on a website in asp.net mvc. I have a route routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); which is the default route. Now I have method public...

Visual Studio 2010 Full and ASP.NET MVC 2.0 Template

Hello, I've installed full version (not RC nor Beta) of Visual Studio 2010, a then setup within Web Platform Installer 2.0 announce me that I need to install MVC 2.0, so i did it. When I want to create project "MvcWebApplicationProjectTemplate" in VS I have following message: error: this template attempted to load component assembly '...

Ideas in implenting the following entry form in ASP.NET MVC 2

Hi guys, I have a very simple data entry form to implement. It looks like this: Obviously I have mocked out the actual requirements but the essence is similar. Entering a name and clicking history should bring up a pop up pointing to the url '/student/viewhistory/{name}' Name and age are required fields The sub form (in the mockup...

Asp.net mvc small amount data storage

Hi there, I am writing some learning tests (i.e. what's the answer for...; choose correct options...). Now my question is, how should I store them. SQL db seems quite an overkill, but I really don't know what would be the best choice if I wanted to select random subset of questions etc. Perhaps some simple xml files? Thanks for advice. ...

How to write a name as an array, mvc

I have the following code: <%int count = 0; %> <input type="checkbox" name="Name["'<%count++;%>'"]" /> The name isnt being rendered as expected, its being rendered as name="IssueCreate["''"]" /> How can I correct that? ...

Add span tage to ActionLink title

I need to add a span tag to the title of an actionlink to output the following html <li><a href="#" id="topmenu1" accesskey="1" title=""><span>Homepage</span></a></li> I currently have <li><%= Html.ActionLink("Homepage", "Index", "Home", null, new { @id= "topmenu1" , @accesskey = "1", @title = "" } ) %></li> which gives me <li><...

DropDownList View Model

I'm trying to produce a dropdownlist for GetAllRoles using the role provider. I can produce the drop down in a controller using ViewData but I would like to use a View Model to produce the dropdown, but I'm unsure of the best way to create the list using a View Model? public ActionResult GetAllRoles() { ViewData["Roles"] = new Selec...

ASP MVC: Sending an E-mail

Okay I'm kindoff new to the .NET platform. And currently i'm learning ASP MVC. I want to send an e-mail from my program and i have the following code: public void sendVerrificationEmail() { //create the mail message MailMessage mail = new MailMessage(); //set the addresses mail.From = new MailAddres...

JavaScript keeps returning ambigious error (in ASP.NET MVC 2.0)

this is my function (with other lines ive tried/abandoned)... function DoClicked(eNumber) { //obj.style = 'bgcolor: maroon'; var eid = 'cat' + eNumber; //$get(obj).style.backgroundColor = 'maroon'; //var nObj = $get(obj); var nObj = document.getElementById(eid) //alert(nObj.getAttribute("style")); nObj.style...

How to add a view for the json result in asp.net mvc?

I returned json result from a controller but how can i add a view that uses this json result.. public class MaterialsController : Controller { ConstructionRepository consRepository = new ConstructionRepository(); public JsonResult Index() { var materials = consRepository.FindAllMaterials().AsQueryable(); r...