asp.net-mvc

ASP.net MVC Web Host for growth

Hi All, Need to find a web host for our ASP.net MVC website (Hooked to an SQL Database). To start with the traffic will be quite low but the room for growth could be huge so we need a web host that can dynamically grow if needed to take the traffic influx. Does anyone have any advice or know of any host solutions for this scenario? Th...

C# mvc2 nhibernate problem

I've got the following mapping in my application. The mapping is generated, by a custom tool. Other mappings generated work ok, but this one is giving me a strange error which I don't understand. This is the mapping; <?xml version="1.0" encoding="utf-8"?> <!--Generated by NHibernate.Mapping.Attributes on 2010-10-29 08:39:48Z.--> <hiber...

MVC Ajax.BeginForm

I have an ajax form like so: <% using (Ajax.BeginForm("Comments", "Comments", null, new AjaxOptions {UpdateTargetId="main", OnSuccess="createSuccess" }, new{ @id="main"})) {%> <%: Html.ValidationSummary(true, "errors") %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%: Html.Lab...

Reference service-side code from <script> tag

I don't know where I got the idea before but a year ago I wrote this in php: <script type="text/javascript" src="http://www.mydomain.com/getmarkers.php"&gt;&lt;/script&gt; Now I'm ready to convert this website to an ASP.NET MVC website and I'm wondering what the best way is to convert this into something more 'normal?'. The options ...

ViewData as a hyperlink

I an ASP.NET MVC we can pass some data via a ViewData and then show it on a page: <%: ViewData["Foo"]%> But how to make a hyperlink out of it? Something like following: <%: Html.ActionLink(ViewData["Foo"], "Index", "Home") %> ...

Upload Picture to a SQL Server database using MVC

Hi guys, I was looking to upload an image (jpg) to a SQL Server database using MVC. Basically - my user would be able to navigate to a page, Browse their computer using a file upload textbox/browse button, and click submit to have the file uploaded to the database. Fairly new to MVC and not quite sure how to go about this. There's ...

File upload issue MVC - assembly reference

I'm trying to put together a page whereby a user can upload a file, and it goes to a database. I'm following a tutorial, and my controller method so far looks like this: public ActionResult Index() { ViewData["Message"] = "File Upload"; foreach (string upload in Request.Files) { if (!Request.Files[upload].HasFile()...

Partial ASP.NET MVC View submit

Hello, I'm new in ASP.NET MVC so the question could appear 'stupid', sorry. I have a Partial View inside my Home view. The Partial View submit a form calling an Action Method inside the HomeController. It works fine with server validation, the problem is that after the post only the Partial View is rendered. How can I render the enti...

what is the best way to show errors on asp.net mvc ajax requests

if i call a ajax request using jquery to an asp.net mvc controller action and inside that action an exception gets thrown, what is the best way to capture that and show something to the user. right now my loading image just goes on forever . . . . here is an example of my controller code: public ActionResult BatchAdd(int[] sharepoin...

ASP.NET MVC Add Child Records Dynamically

Using the Entity Data Framework, I have a model defined called Client which simply contains an id and a name. I then have an association with another model called Appointment containing an id and a date. For the form, I wish to allow users to create a new client and on the same form, add appointments (before the client is created). I ha...

MVC partial rendering issue using Razor

Hello, I have _Layout.cshtml defined for my mvc application, which is shown below: @inherits System.Web.Mvc.WebViewPage @using Webdiyer.WebControls.Mvc; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> @RenderSection("HeaderContent", false) </head> <body> @RenderBody() </body> </html> On the page SomePage.cshtml, ...

Approaches for Application Configuration and Settings (in ASP.NET MVC)

For a CMS product/platform, what would be a maintainable and clear approach for editing and storing settings? I'm not talking about technical (connstring, nh config, ...) settings, but settings that alter the behaviour of the product: These settings are for example Online Payment settings Available parts and modules Default behaviour...

DropDownList Validation - Problem

Hello guys... I'm having a problem in ASP.NET MVC with DropDownList validation. I have two actions "Create". They are defined as follow: public ActionResult Create() { var categoriasDownloads = from catDown in modelo.tbCategoriasDownloads orderby catDown.TituloCategoriaDownload ascending ...

MVC pass model object from controller to view

Hello everyone, I am trying to figure out how to pass the model object from controller to view in a following scenario: <% Html.Action("GetRequest", "The_Controller", new { requestId = 12 }); %> <% Html.RenderPartial("Request", ViewData.Model); %> The action should, and it does, call the controller's method which looks up the Request...

ASP.NET MVC 1 .. Ajax.BeginForm within Html.BeginForm. How to post without stopping and starting Html form?

For example.. <% using (Html.BeginForm()) { %> <%= html.textBox(Model.IwantThisField)%> <%using (Ajax.BeginForm("ActionName", new AjaxOptions { fancy ajax options })) %> <%{%> <label for="stringVar">This is sent to Action</label> <input type ="submit" id="button" /> <%}%> <%= html.textBox(Model.IalsoWantThisField) %> <...

Error: foreach statement cannot operate on variables of type IENumerable

Hi guys, I'm following the sportsStore tutorial from the Apress Pro Mvc 2 Framework book. It's been a while since I touched .net, and I'm completely new to Mvc and I've fallen at the first stumbling block! I have the following error: foreach statement cannot operate on variables of type 'IENumerable' because 'IENumerable...

Portable View Engine Options (PHP / ASP.NET)

With MVC possible in both ASP.NET MVC and PHP (CodeIgniter, CakePHP etc) what are the options when it comes to using a view engine that could work with both platforms, enabling copy/paste without any changes? Ones I can think of are: NHaml / PHPHaml (not updated for 3 years though) / PHamlP I am assuming this works with CodeIgniter or...

Should I use the entity framework or linq to sql for new mvc project?

I have a new project where I want to use MVC (I will be learning as I code), and I have never used linq or entity (or mvc). Which should I use? Does it matter? edit: I will be having a lot of different databases, from Oracle to FoxPro. ...

What is a good intermediate-to-advanced ASP.NET MVC 2 book?

I am relatively new to ASP.NET MVC, but I have developed a couple of simple applications using it, so I am not completely new. I have gone through the majority of tutorials on http://www.asp.net/mvc and I have read the "Professional ASP.NET MVC2 (Wrox)" book by the guys over at Microsoft. I have also done some extensive reading on DDD, T...

BeginRequest fires for static files in ASP.NET MVC app

I was under the impression that static files (CSS, images, @font-face files, etc) bypassed ASP.NET completely, and were served directly by IIS. However, my BeginRequest event handler is being called for every HTTP request, including those for static files. This concerns me because I'm creating an Entity Framework data context to be u...