asp.net-mvc

Using MySql with Entity Framework 4 and the Code-First Development CTP

I thought I'd experiment a bit with Scott Guthrie's latest post on code-first dev with Entity Framework 4. Instead of using Sql Server, I'm trying to use MySql. Here are the relevant parts of my web.config (this is an Asp.Net MVC 2 app): <connectionStrings> <add name="NerdDinners" connectionString="Server=localhost; Databas...

Error Handling Not working ASP .NET MVC

Hello, I have created a new MVC Application in VS2010 straight out the box. In the Home Controller I have ther following: [HandleError(View = "Error")] public ActionResult Index() { int num1 = 0; int num2 = 5; int result = num2 / num1; return View(); } This creates an error and a d...

Hide a column in a javascript populated table

I would like to hide the entire age column on this table. <table id="displayTable"> <tr> <td class="Name"></td> <td class="Phone"></td> <td class="Age"></td> </tr> </table> Javascript follows to hide Age cell - var table = document.getElementById('displayTable'); var tableRow = table.getElementsByTa...

Using an HTML button in MVC

I feel a bit stupid asking this, but I just want to know how I can have a html button call a server site action on my controller. For example lets say I have a Text Area and a submit button. The idea would be to click the submit button and the text in the text area would get submitted to the Database. Very simple stuff. Thank you for t...

How to create GoogleMap marker auto update?

I'm working on mvc project which include Google map inside My system allow user to send tweet to system and keep it in database then will show tweet on the map what i need to do is "Auto update marker on the map when system get the new data" any suggestion? thank you very much ^^ ...

HTTP Host header as route value

I am trying to serve multiple virtual hosts from the same code base. One thought I had was pass the HTTP Host header as a route value because I did't want to rely on HttpContext in the controllers because of unit testability. I had planned on exposing this route value in a controller base class or something like that. I tried passing ...

MVC RequireHttps entire site

I have read the previous posts about using the RequireHttpsAttribute to secure individual controllers: http://stackoverflow.com/questions/1639707/asp-net-mvc-requirehttps-in-production-only but is there a way to apply this to the entire site? Due to my host (discountasp.net) I cannot use the "RequireSSL IIS" setting. ...

How to implement a Windows Service to manage Session state?

I'm working on an ASP.NET MVC web application that will be deployed across multiple load-balanced servers. With this setup, a user might have one request served by server A and the next request will be served by ServerB or ServerC. We don't want to store Session Data in the database, as we're trying to minimise database hits where ever...

Dynamically generate CSS file from database in ASP.NET MVC

I'm looking to add some basic theme support to my web application, with users being able to customise various parts of the look. These include things like colours, text sizes, fonts, other basic things. I will be storing these in the database and loading them each time a page is accessed. My question is, how do I go about generating a d...

Asp.net mvc 2 validate user control

Hi, I am developing a site that needs to have a small form repeated in a lot of pages. So I decided to create a user control (partial view) that has this form. This form posts to an action, so I have: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SampleProject.DoSomethingActionVM>" %> <%= using(Html.BeginForm("DoSo...

jquery file uplaod form plugin response issue

I find form plugin interesting and i want to know that how i can embed ajax response in html text area in asp.net mvc 2. any idea? Here is the link of that control http://jquery.malsup.com/form/#file-upload ...

Adding data to database using MVC - with FK relationships.

Hi- I have a database and I am using the Entity Framework with Linq 2 Enities. I am working with ASP.NET MVC 2. I have a database with two tables as shown bellow: Classifieds Catergories ID(PK) CatID(PK) CatID(FK) CatName Desc ... Obviously when the user adds a new classified and when they c...

how to get the last accessed action in asp.net mvc

How can I get the last accessed 'Action' in a asp.net mvc app. Example I have a menuItem called 'Add to Favourites" when clicked is navigated to a page in which I need to populate a textbox with this url ...

Telerik reporting in ASP.NET MVC project

Can anyone help me in implementing telerik reporting in ASP.NET MVC project? ...

should I always use <%: instead of <%=

I know that <%: does the html.encode thing, but there are lots of situations when I'm sure that I don't need to encode, so why should I waste time on encoding stuff that I'm 100% sure it doesn't require to be encoded like for example <%:Url.Action("Index") %> or <%: Model.Id %> (is of type int)? ...

asp.net MVC2 Books

Hi all I know this has been asked many times but its been more for MVC1. I don't know if it matters all that much if its a MVC1 or a MVC2 book. But what I am looking for is a good book to get me started on asp.net MVC2 and a other book to read after for further reading. Now if these two books could be warped up into the that would be gr...

ASP.NET MVC render partial from the POST method

Problem I have Telerik TabControl and each tab content is a partial view. Everything works smoothly when request is GET: // // GET: /ProductVersion/Translations public ActionResult Translations(Guid id) { VersionEditTabViewModel model = CreateTranslationsViewModel(id); return PartialView("Translations", model); } Now ...

how can i keep my url when my validation fail in asp.net mvc controller action

if i start off on a Detail page: http:\\www.mysite.com\App\Detail i have a controller action called Update which normally will call redirectToAction back to the detail page. but i have an error that is caught in validation and i need to return before redirect (to avoid losing all of my ModelState). Here is my controller code: pu...

Object reference not set to an instance of an object

With this code I have error: Object reference not set to an instance of an object, why <% using (Html.BeginForm("XMLDevicesAddFirmware","ImportXML",FormMethod.Post)) {%> <table class="data-table"> <tr> <th> Article Number </th> <th> Firmware </th> <th> Na...

Getting nested data out of JSON in C#

Hi, I have some JSON with Two objects and these each have 3 objects nested. { "FirstPerson": { "number": "101", "a10": "1001", "a20": "1002" }, "SecondPerson": { "number": "102", "a10": "2001", "a20": "2001" } } In c# asp.net mvc2 I've been able to get to "FirstPerson" ...