asp.net-mvc

MVC Updatemodel not updating from DropDownList

I have the following on my edit screen: <label for="campaign.CandidateID">Candidate:</label> <%= Html.DropDownList("Campaign.CandidateID", Model.Candidates, "Choose...")%> <%= Html.ValidationMessage("CandidateID", "*") %> and in my controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int id, FormCollection formValues) {...

How to shrink html string size

I have a listing page to display a set of products. Each item has its own well-formatted HTML description. I wanna display part of each item's description to a maximum of 200 characters excluding the html tags and html attributes. The problem is when I cut down the html string, the return result of html string may not be well-format(may...

How to post form data on an UTF-8 page to a western european (ISO) page

I need to post a form on a new website which is UTF-8 encoded. The problem is - i need to post it to a legacy site encoded with western european (iso). Certain characters gets messed up in the post (like danish special characters). It is not possible to change the character encoding on the legacy website as it would definately break stu...

Ajax enabled GridView in ASP.NET MVC is possbile or not?

Hi, I need to display some contents in gridview which should be an ajax enabled gridview. how can i acheive this in mvc? ...

for loop statement outputs that links to differnent controllers in asp.net mvc

i have a looping statement in in my homepage for news.. I have these codes.. Model : Imports Microsoft.VisualBasic Imports System.Data Public Class ClassNewsConnection Inherits ClassConnection 'Featured News for Home Page Public Function NewsFeatureHome() As DataTable Return ReadData("SELECT * FROM news WHERE n...

ASP.NET MVC - System.Data.DataSet not referenced problem

Hi There, Well, first of all sorry about this question it must be pretty straight forward for you guys but I'm struggling myself on it, and I need to make it work :( Well I'm trying t o use DataSet on my application and when I render it I got: The type 'System.Data.DataSet' is defined in an assembly that is not referenced. You must add...

Redirect to page not found page if the url does't exist in mVC

Hi, I need to redirect the user to page not found page if the url doent exist. if the user copy the url and paste it on the rbowser, the page shows page not found method. in this i need to redirect the user to page not found page ...

Multiple forms on one view in ASP.Net MVC while retaining validation

In a small web app I'm making for internal use, I want the user to be able to select one of the data files to open. I have a strongly typed view which takes the list of files as the model. My initial version had an Index action which got the list of data files and returned the view, then a Create action for creating a new file, and an U...

The SessionStateTempDataProvider requires SessionState to be enabled.

HI i am getting error : "The SessionStateTempDataProvider requires SessionState to be enabled." when i try to handle the error. i got a piece of code from the blog below. http://blogs.microsoft.co.il/blogs/shay/archive/2009/03/06/real-world-error-hadnling-in-asp-net-mvc-rc2.aspx i am not using any session. my session state is set to off ...

Areas And Routes

I'm using areas everywhere and I'm wanting something like the following: http://localhost/MyArea/MySection/MySubSection/Delete/20 Usually I access things by doing the following: http://localhost/MyArea/MySection/MySubSection/20 But if I want to delete then I have to say http://localhost/MyArea/MySection/DeleteEntryFromMySubSection...

ValidateInputAttribute not used in custom Controller Factory

I use the following Controller Factory with StructureMap: public class ShopControllerFactory : DefaultControllerFactory { protected override IController GetControllerInstance(Type controllerType) { if (controllerType == null) throw new HttpException(404, "Controller Not found"); try { return ...

Why doesn't this code work in another solution?

I have the below code in my current solution, which returns an error of 'The value '' is invalid'. The below snippet has been shortened to just show the problem area as opposed to the entire ActionResult. Dim tComment As New hdComment tComment.Comment = collection("wmd-input") tComment.MadeOn = DateTime...

Repeating a Parameter in a ASP.NET MVC Route

I am trying to write a route that matches the following URL format: /category1/category2/S/ where the number of categories is unknown, so there could be 1 category or there could be 10 (1..N). I cannot use a catch all becuase the categories are not at the end of the URL. I am actually routing to a web form here (using Phil Haack's ex...

How to use MVC Action Results from regular web forms (faking ControllerContext)?

We have a pluggable framework that returns ActionResult objects that render things to a browser. One late breaking requirement is that our plugins should be callable from a regular ASP.NET Web Forms application. So far I have come up with this, which works for very basic ActionResults: public class ActionResultTranslator { HttpCo...

Reminder Alert as in google for asp.net mvc

I need to show a message to the online users as alert popup like reminders in google calendar. Can we use any background process like web service/windows service to achieve it? Or is there any reliable way to do it? ...

what are options availble for rich reports implementation in asp.net mvc?

I want to implement rich reporting features in one of our asp.net mvc based web applications. The required features in the reports are Graphs Charts Grouping, sub totals, page breaking, etc Ability to export to excel, pdf, csv and other formats Printing Support We are ready to purchase commercial controls(if free ones are not availab...

ASP.NET MVC: Strange typecasing error ....

Strange typecasting error: System.string -> weekmenu.SimpleTable Controller Function Index() As ActionResult ViewData("ListFrontName") = WeekMenuRepository.ListFrontName() ViewData("ListLastName") = WeekMenuRepository.ListLastName() Return View() End Function WeekMenuRepository Public Function ListFrontName() Implement...

ASP.NET MVC form that redirects to a route

Hello is it possible to have an ASP.NET MVC form that uses the routes defined in Global.asax to post its values (via a GET request)? I have the form defined like this: <% using (Html.BeginForm("CanviaOpcions","Sat",FormMethod.Get)) { %> <fieldset> <legend>Opciones</legend> <%= Html.DropDownList("nomSat")%> ...

show javascript alert from controller's action in asp.net mvc

Is it possible to show a javascript alert message from controller's action in asp.net mvc(C#)? ...

ASP.NET MVC Custom View Engine Not Being Called.

I am attempting to impliment a custom view engine to serve mobile views based on the user agent. I am following Scott Hanselman's approach from this blog post. I have inherited from the WebFormsViewEngine and overridden the FindView method the same way that Scott describes in his blog. I then added a few lines to my Global.asax Applica...