asp.net-mvc

ASP.NET MVC. Hot to guess autogenerated id value ?

My web form contains list of dynamic fields that are generated like this: <% for (int i = 0; i < Model.Options.Count; i++) { %> ... <%= Html.Hidden("Options[" + i + "].Id", Model.Options[i].Id)%> <%= Html.CheckBox("Options[" + i + "].Selected", Model.Options[i].Selected)%> ... This maps perfectly on array of controller method ...

Loginview control asp.net mvc

Hello all, I have been searching and haven't got luck, I got a tutorial to use the loginview control in order to display or hide parts of the views to different user roles in my application. The thing is that the tutorial I've found is for ASP.NET and I've been told by one of my colleages that it is the same framework for ASP.NET MVC bu...

Routing optional parameters with dashes in MVC

I've made an routing definition like this: routes.MapRoute("ProductSearch", "Search-{MainGroup}-{SubGroup}-{ItemType}", new { controller = "Product", action = "Search", MainGroup = "", SubGroup = "", ItemWebType = ""}); It is not working if the parameters are empty. Actually it resolves the url, so Url.Action method re...

Making a Lambda Expression Target a Delegate regardless of signature

Ok, maybe the title isn't the most descriptive thing in the world, but this problem is killing me. What I'm trying to do is create an ActionLinkFor helper method, like so: public ActionResult Index() { // Does Stuff } public ActionResult SomeAction(int param1) { // Does Stuff } These are two action methods. Action methods can h...

asp.net mvc route clashing with physical path in IIS7

I'm messing about with controller organisation and I've hit a problem. If I have the following physical structure /Home/HomeController.cs /Home/Index.aspx /Home/About.aspx and I request the URI: /Home/Index I get a 403 Directory Listing Denied :( (im using a custom IControllerFactory and IViewEngine to look in this non-default pa...

json returned from a jsonresult in asp.net mvc .....

I am returning this from a json result from a controller, var genericResult = new { redirectUrl = Url.Action("Create", "Registration") , isRedirect = true }; return Json(genericResult); but when i inspect through firebug, {"redirectUrl":"/","isRedirect":true} if (data.isRedirect) { ...

ASP.NET MVC: Ajax.Actionlink Does not work with parameters

<%= Ajax.ActionLink("DrillDown", "EventOverzichtAjax", new { GroepID = Model.GroepID.ToString(), groepType = Model.GroepType.ToString(), manager = Model.isManager }, ...

Custom HTML attributes on SelectListItems in MVC2?

I have a need to add custom HTML attributes, specifically classes or styles to option tags in the selects generated by Html.DropDownFor(). I've been playing with it, and for the life of me I can't figure out what I need to do to get what I need working. Assuming I have a list of colors that I'm generating the dropdown for, where the op...

asp.net mvc dowload file

Hi Im having trouble downloading files using asp.net mvc y ycode is quite straight forward and seems to work for pdf's only. It does not work for other filetypes the code is below and the mime types I use for the documents are below. return File(doc.filepath, mime, doc.title); Microsoft Word .doc application/msword Adobe Acrobat .p...

How to save in Hindi in database using MVC application

I have a MVC application and using the entity framework model for MYSQL database. I what to save hindi text in database. When I using the hindi text then it is showing ?? in database. I am using ckeditor to enter the text How can I save the hindi text.I have also changed the collation to utf-8. Thanks supriya ...

ASP.NET MVC Generic Controllers and Spring.NET

Hello, I am creating an application using ASP.NET MVC (2) and Spring.NET. Since most of my Controller implementations just implement the similar CRUD operations, I would like to just create a single Generic controller, as explained here: http://stackoverflow.com/questions/848904/in-asp-net-mvc-is-it-possible-to-make-a-generic-controll...

how to remove IEnemurable in asp.net mvc

I have a view with <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<StudentInfo>>" %> in my view if i have IEnumerable I can do foreach.. but before that i need to access the properties for StudnetInfo.. StudentInfo clas having Public class StudentInfo { public Studentdetails sd {get;set;} public c...

ASP.NET MVC send an email attachment which is a password encrypted PDF file

I am working on document storage and retrieval application. In which i display the pdf document as an png image , but i have a email button on the top. On clicking that the user would be able to provide an email address to which the document needs to be sent, and I need to send this pdf as an attachment. I need to password protect the f...

How to generalize view?

Hey guys, I'm in the process of designing a set of views that use the same model in my app, the difference is that some views will differ in Read Only and Modifiable fields. So for example for view A I want to be able to modify A.One but no A.Two properties and for view B I want to have B.One and B.Two as modifiable fields. I was think...

Can I do something like this?

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<StudentInfo>>" %> <% int i = 0; %> <% foreach(var e in Model){%> <div> <% if(i==0) { %> <% Html.RenderAction("student", "home", new { @et = e}); %> <% break; } %> <div> <span> <% Html.RenderAction("studentDetails", "home", new { @et = e });...

How to get related / similar search results?

Hello Guys! What's the best way in ASP.NET MVC to get a few questions related to the current question (like on stackoverflow) without using tags? ...

ASP.NET MVC FileNotFoundException error

I'm having a weird error which is related to an earlier post. I am checking if a file exists before downloading. This works for PDFs, but not for any other type of document. Here is my controller action and the typical path for a PDF and a PowerPoint file, the PowerPoint does not work, the File.Exists always returns false. Both files ph...

mvc DataAnnotations how to make field no editable in 3.5

I have a few field in my entity that i wish to be non-editable. Looking in the docs it seems like "EditableAttribute" would do the trick. However this is only 4.0 Just wondering if there are other attributes that would have the desire effect. So be clear, i have a field called "DateRegistered" i wish to display this as string not text...

why would i get a different views when called from different controller actions in asp.net-mvc

I have 2 different controller actions. As seen below, one calls the same view as the other one. The fitness version has a bunch of jquery ui tabs. public ActionResult FitnessByTab(string tab, DateTime entryDate) { return View("Fitness", GetFitnessVM(DateTime.Today.Date)); } public ActionResult Fitness() {...

NHibernateUnitOfWork + ASP.Net MVC

Hi Guys, hows it going? I'm in my first time with DDD, so I'm begginer! So, let's take it's very simple :D I developed an application using asp.net mvc 2 , ddd and nhibernate. I have a domain model in a class library, my repositories in another class library, and an asp.net mvc 2 application. My Repository base class, I have a construct...