asp.net-mvc

Specificying a Page directive attribute on an NHaml page

I am working on an MVC site using NHaml for the view engine. I have a page that needs to submit HTML code as a form value and am getting the System.Web.HttpRequestValidationException thrown at me. I want to specify the <%@ Page validateRequest="false" %> so that this page will allow this data to be submitted but am unsure on how to do ...

Could the UIHint attribute accept a property of the current class ?

I found the follwing code in MSDN . How can I change this "UnitsInStock" with a value that my Product class has. For instance, Product has a FieldType property which has a string property called Name. I'd like to use that FieldType.Name property instead of hardcoding with a string. However, I cannot specify "this", or the current instanc...

Getting multiple checkboxes from FormCollection element

Given multiple HTML checkboxes: <input type="checkbox" name="catIDs" value="1" /> <input type="checkbox" name="catIDs" value="2" /> ... <input type="checkbox" name="catIDs" value="100" /> How do I retrive an array of integers from a FormCollection in an action: public ActionResult Edit(FormCollection form) { int [] catIDs = (IEnu...

3-tier architecture v. 3-server architecture

I'm building a traditional .NET MVC site, so I've got a natural 3-tier software architecture setup (presentation in the form of Views, business layer in the controller, and data layer in the models and data access layer). When I've deployed such sites, it usually goes either on one server (where the web site and db live), or two servers...

How can I make this Route (ASP.Net MVC2) ?

Hi All, I'm begginer in asp.net mvc and I have some doutbs about routes. Im' developing a system to manage documents and I need make an URL like this: routes.MapRoute("Documentos", "{controller}/{documentType}/{documento}/{action}/{id}", new { controller = "Home", ...

ViewData.* and TModel in asp.net MVC

After a week of asp.net mvc2, I still haven’t understood the advantages of ViewData.model or rather how I can properly utilize Viewdata. Can some teach me how to use Viewdata properly? Also what’s TModel that’s associated with viewdata? How does one utilize TModel? The viewdata explanation in spark view engine talks about TModel and I c...

Search and highlight - Client vs. Server side?

Hi everyone, I have an MVC web application that shows ~ 2000 lines "divs", and I want to make the user able to search and highlight the keywords. I tried using jQuery plugins for this but the performance was really bad and IE got almost hung! So, I was wondering if this is the best way to do it? and If am not getting a faster version I...

What is the proper way to access datastore in custom Model Binders?

How should I properly implement data access in my custom model binders? Like in controllers I use IContentRepository and then have it create an instance of its implementing class in constructor. So I have everything ready for incorporating IoC (DI) at a later stage. Now I need something similar in model binder. I need to make some DB ...

Add child to existing parent record in entity framework.

My relationship between the parent and child is that they are connected by an edge. It is similiar to a directed graph structure. DAL: public void SaveResource(Resource resource) { context.AddToResources(resource); //Should also add children. context.SaveChanges(); } public Resource GetResource(int reso...

Is it possible to have two projects sharing one master view?

I have two different projects within a solution in ASP.NET MVC. Is there a way to have a master view shared between both projects? ...

How to handle HttpSession in MbUnit

I have a ASP.NET MVC 1.0 Controller which implements a HttpSession object for storing sorted result How I can test the Controller from MbUnit? ...

How to use relative URL in jqGrid url parameter in ASP MVC?

I've setup a jqGrid like this $('#gridTable').jqGrid({ url: '/GridData/', ... Now if I navigate to a url such as "/Controller/id/" then the grid will send a GET to "/GridData/" instead of "/Controller/id/GridData/". Can I make the GET relative so that I can pick the id up on the server side or do I have to manually pass the id as...

Setting objects (not users) inactive after period of time in asp.net mvc

This question is mainly to verify my current idea. I have a series of objects which I want to be active for a specified amount of time. For instance objects like ads which are shown in the ad space only for the amount of time bought, objects in search results which should only pop up when active, and frontpage posts which should be set t...

Enabling Session State in ASP.NET MVC

I'd like to use session variables in my ASP.NET MVC application. I already added the <sessionState> tag in my web.config file like this <sessionState mode="InProc" cookieless="false" timeout="20"> </sessionState> I get a session ID in my url like this if I use cookieless="true" http://localhost:2967/%28S%28hcawmi55zoruuy453fbo3k...

MVC WebFormViewEngine and Security

Hello all, Asp.net webformview engine is quite flexible and easy to be used in the projects. I have been facing with a small problem recently. SECURITY! I want my users to design the web pages in front. BUT!! with a small code, the people who have bad intention, can get the content of my dll files in bin folder. e.g. <% Syst...

How I Can code for Open Id in My Asp.net MVC Project?

I want to insert code for Open Id. I am unable to find article based on this. Please Help me With giving me a link of article? Your articles help me very much. ...

Handling autopostback in ASP.NET MVC

How do I handle autopoatback in ASP.NET MVC? Suppose I have a textbox. I enter a value in it, I need to check if the value exists in some table in the database. So in ASP.NET forms I can set AutoPostBack = true and handle the TextBox.TextChanged event. How do I do it here? And what are the pros and cons of using ASP.NET server control i...

How to write the following in MVC?

How can I write the following in MVC? <input type="text" name="ProjectList[' + count++ + '].ID" value = ' + value + ' /> ...

DB access denied with ASP.Net MVC application after switching to windows authentication mode

I have a MVC application that I am now trying to add authentication and authorization to. I want to allow users to get to the site and be automatically authenticated. So I set authentication mode="Windows" in the web.config, and enabled NTLM in the project options. The site now shows my domain name in the top right when I run it, but wh...

MVC2 and MVC Futures causing RedirectToAction issues

I've been trying to get the strongly typed version of RedirectToAction from the MVC Futures project to work, but I've been getting no where. Below are the steps I've followed, and the errors I've encountered. Any help is much appreciated. I created a new MVC2 app and changed the About action on the HomeController to redirect to the Inde...