asp.net-mvc

Getting a member via string in C#?

My question stems from MVC's SelectList (and previous generations). Basically the class takes in an IEnumerable and uses the members you define as strings. How does it interface with the object (casting, reflection?) (probably redundant) How does it lookup the members as a string. This is one facet of C# that I have been interested ...

Intermittent asp.net mvc exception: “A public action method ABC could not be found on controller XYZ.”

Hi, I'm getting an intermittent exception saying that asp.net mvc can’t find the action method. Here’s the exception: A public action method 'Fill' could not be found on controller 'Schoon.Form.Web.Controllers.ChrisController'. I think I have the routing set up correctly because this application works most of the time. Here is ...

Should i create urls in the view or the controler?

I have user friendly urls that are generated and stored in a database.. When I want to get a url I have a helper class that gives me the urls.. this helper method sometimes calls to the database to generate a url.. According to separation of concerns should i generate all the urls needed in a page in the controller and pass them to...

Updating AppSettings via ASP.NET MVC Controller

I'm writing a basic little forums web app (for fun and to sharpen the ole' saw), and I'm having a bit of trouble with AppSettings. My plan is to have these settings in their own file (Settings.config), to which I will grant modify permissions to the web process user account, and store all editable settings in this file (e.g. forum title...

Advanced Search Design for Large Objects

I’m looking for some advice. I recently wrapped up a project where I inherited some terrible code. I got the application running but it’s safe to say there are a number of performance and design issues, specifically with the advanced search functionality. I have now been asked to do a very similar project but much larger in scale. I have...

Do I need to reset a stream(C#) back to the start?

Hi I don't know too much about streams in C#. Right now I have a stream that I put into a stream reader and read it. Later on in some other method I need to read the stream(same stream object) but this time I get this error System.ArgumentException was unhandled by user code Message="Stream was not readable." Source="mscorlib" St...

How to embed links in localized text.

Problem: I am internationalizing an ASP.Net MVC application, but sentences with linked text have given me pause. Take the following as an example: English: "Please login to continue." Português: "Entre por favor para continuar." Note that since "login" is hyperlinked, I must have the translator denote which corresponding word or ph...

Less Linq to SQL and more Repository way to provide Rule Violations?

In the nerd dinner, they use partial keywords to overload the Linq to SQL classes to embed the data validation. Let's say you want to data validate exclusively in the repository. Is there some website link out there that shows how to construct this in a way that can feed the Html.Validation helpers seamlessly? I heard this is changing...

Linq2SQL related records

I'm sure this has been answered but I can't find it. Say I have three tables; Projects Id <= unique key name Attributes Id <= unique key Name ProjectAttributes id <= unique key ProjectId AttributeId I'm using a dbml file and I have all the associations drawn up within the dbml. So how in my view, do I itterate through al...

The incoming request does not match any route in My sample mvc application

Hai guys, I started a new asp.net mvc application and i followed the steps given in http://www.packtpub.com/article/your-first-asp.net-mvc-application when i press F5 i got the error "The incoming request does not match any route"... Any suggestions .... Update: public static void RegisterRoutes(RouteCollection routes) ...

asp.net mvc: more info on UpdateModel exception

Hi, i sometimes get an error with the UpdateModel function. However, i can't seem to locate the exact message which field(s) is/are causing the problem. For example this one: "The model of type 'Enquete' was not successfully updated." it has an innerexception of NULL, and no further description. Is there a way to find out what is causi...

using web control

Hi, I have a basic question. I have created a MVC project. I made a change to the LogOn.aspx. Instead of HTML textbox control, I used an asp's text box control for the UserName text box. I tried to debug this, and i foung that the UserName parameter is being received as null in LogOn (POST)action. Can anyone please explain what's the rea...

ASP.NET MVC xVal with Strongly Typed ViewModel

I can't get xVal validation to work with strongly typed viewmodels. Every method in xVal seems to want a prefix which is not used when dealing with strongly typed viewmodels. My view contains code similar to this: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ContactForm>...

Deleting multiple records in ASP.NET MVC using jqGrid

How can you enable multiple selection in a jqGrid, and also allow users to delete all of the selected rows using an ASP.NET MVC controller? I have set the delete url property to my /Controller/Delete method, and this works fine if one record is selected. However, if multiple records are selected, it attempts to send a null value back to ...

PartialView as string + JsonResult

I'm just looking for a nice way how to return JSON object from server that contains html of partial view and some additional data if needed. I'm using approach by Tim Scott to render partialview as string (with some modifications - made it to be viewenginescollection aware, made it to understand difference between view and partial view,...

Post action Create in asp.net MVC.

Hello, i'm using MS northwind database, and use Entity Framework. I want to create new product, and use dropdownList to load CategoryName from Category Table. public ActionResult Create() { var categories = from c in _en.Categories select c; ViewData["CategoryID"] = new SelectList(categories, "CategoryID", "CategoryNam...

ASP.NET MVC. Create sub folders in the controller

How can I do in ASP.NET MVC, to take sub folders. For example, taking the following folder structure on the controller: /Controller /Blog ViewsController.cs ArticlesController.cs /Customers SalesController.cs ProductsController.cs HomeController.cs I would like to have the following folder structure in view, ...

Asp.Net MVC Html.ActionLink and Rails link_to. :method equivilent for ActionLink?

Rails link_to allows one to pass in :method for post and delete action verbs. Is there an exention ou there for Asp.Net MVC that does the same sort of thing? I saw something close on haacked that was for deleting. I could use something similar. ...

Retrieving a jQuery autocompleted field

I am using the jQuery autocomplete plugin and have wired up an input field to retrieve values from a back end database as text is entered which can then be selected. I then have a second input field that I have wired up in a similar way however I want to pass in the first input field's value as a querystring parameter in the autocomplete...

Renderpartial conditionally on masterpage in asp.net mvc

Hi I have the following menus defined on my masterpage in a asp.net mvc web application <%Html.RenderPartial("AdminMenu"); %> <%Html.RenderPartial("ApproverMenu"); %> <%Html.RenderPartial("EditorMenu"); %> However I want to only display the right menu depending on the logged in users role. How do I achieve this? I am starting to thin...