asp.net-mvc

Hisory points in MVC2

How can we create history points for each view in MVC? And how can we delete the previous history point while navigating a web site? Thanks, kaps ...

ASP.NET MVC w/ Entity Framework - UpdateException

Hi All, I am encountering a problem when I go to update an object in my database using Entity Framework. Firstly, the concept is: A user can be a member of a group, hence a Group contains Users. To model this in the database, I have the following structure: Users: ID Name etc. Groups: ID Name GroupMembers: ...

MVC2, MySparkView custom base page and Html.BeginForm

Hello, I'm currently trying to get MVC2 and Spark to work happily. Everything looks great, however I can't for the life of me get Html.BeginForm to write out the form tags. My code is: #Html.BeginForm(); <div> <fieldset> <legend>Account Information</legend> <div class="editor-label"> ${Html.LabelFor(m => m.UserNam...

Generate URL inside a Controller in ASP.NET MVC

Hello, Is there a way to generate URL inside a controller? I want to do the following inside a controller instead of a view. <% =Url.Action("Validate", "Home", New With {.ValidID = ID})%> ...

ASP.NET MVC 2: Better way to handle multiple buttons in each HTML table row?

I have an HTML table where each row has buttons which toggle status bits in the database for each row. Assuming Javascript is not an option, what would be the "best practice" way of handling this? I'm currently handling it by wrapping each row in a form like this: <table> <tr> <td> <form action="/FooArea/BarCont...

Rails compatible .NET xml serialization

I am writing an ASP.NET MVC 2 site with REST endpoints. I want to consume this service with ActiveResource in a Rails web application. So far, I've managed to get routes setup in ASP.NET MVC that match the ActiveResource conventions. But where I'm having problems is with de-serializing the data that ActiveResource sends to the REST se...

Asp.net Mvc 2.0 RC Setting Thread CurrentCulture/Ui

I been pulling my hair out all day. i can't seem to set the current thread cultureui or culture to anything other than English. In the controller i have protected override void Initialize(System.Web.Routing.RequestContext requestContext) { base.Initialize(requestContext); CultureInfo cultureInfo = C...

retur to a url from an action method asp.net mvc

Im using asp.net mvc. i have links associated with a list of "Document"...when clicked the links call an action method to add the document to a list of favourites. how in the action method do i return to the same page before the "add favourite" link is clicked? the reason is i want to maintain the querystring parameters that have pagin...

Advanced best practices for ASP.NET MVC2 & JQuery

I am going forward with developing my first ASP.NET MVC web app, coming from years of ASP.NET WebForm development. I have already read an MVC book so I know what MVC is all about. I like to use the latest and the greatest so I am planning to use VS 2010, MVC2, C#4 and JQeury 1.4. Any best practices or design patterns when using ASP.NET...

How do I find out what user my ASP.Net MVC application is running as?

I want to display the windows user that the application is running as on a diagnostics page on my ASP.Net MVC database check page to help the user check whether they've setup their IIS correctly. Where can I find that information? I tried System.Threading.Thread.CurrentPrincipal.Identity.Name but that appears to contain the logged in u...

ASP.NET MVC 1.0 Controller Action With Same Signature

Hi everyone, So basically in my UserController.cs class I have an Index method that returns the ActionResult to display the dashboard for the user. On this page is a html button with a type of submit. When I hit this button I want to capture it on the server side log the user out. How can I do this since I'm not passing information ba...

Execute SqlPS Scripts from Asp.net

I would like to execute sqlps scripts from asp.net. With this article I was able to run simple powershell comannds but don't know how to invoke sqlps. Thanks, Fahad ...

Why is file uploading failing in ASP.Net MVC?

I am uploading files using HttpWebRequest to an ASP.Net MVC application but, for some reason unknown to me, it is failing to upload consistently. I know the file is good since if you try enough times it does eventually upload and can be viewed on the server just fine. When it fails, neither the server nor client reports any errors dire...

enable/disable checkbox & button based on value from database on ASP.NET MVC View page?

I have ASP.NET MVC view page that has Checkbox(Active) and a button(Activate). Here are somethings I want to do: If the value from the database is True, The checkbox should be Checked and Enabled and so button also should be Enabled. Else If the value from the database is False, The chekbox should not be Checked and Disabled. And ...

How do I make an entry field optional?

I have made an entry field required somehow but I'm not sure how. When editing a tag, the tag owner entry field should be able to be empty. I have set "allow nulls" in the database table: Does anyone know how I can fix it? To be clear, I want the above form to be submitted without requiring a value for tag_owner. ...

In what order should we implement Asp.Net Mvc App

This might be odd question but I am just goig to start a new Medium size WebApplication using Asp.Net MVC. Every person has his own approach towards a solution, but there are always some practices followed. While Working With Asp.Net Forms Application I always, worked in following order Database Data Access Layer (LinqToSql / Ado.Ne...

what exactly is strongly typed View data in Asp.Net MVC

What is meant by "strongly typed view data" in Asp.Net MVC ? Thanks ...

Custom model binder for a property

Hello! I have a following controller action: [HttpPost] public ViewResult DoSomething(MyModel model) { // do something return View(); } MyModel looks like this: public class MyModel { public string PropertyA {get; set;} public IList<int> PropertyB {get; set;} } So DefaultModelBinder should bind this without a problem. The ...

ASP.NET MVC - Captcha as stand-alone assembly

I've implemented CAPTCHA for a form submission page in my app as per code I got from Pro ASP.NET MVC Framework book. He has a Tip in there that says "if you want to turn this into a reusable, distributable CAPTCHA component... all you have to do is to put the CaptchaHelper and CaptchaImageController classes into a stand-alone assembly...

I can access the querystring variable on a GET request, but not a POST

If I try and access a webpage that has a filter that checks for authentication, it redirects to the login page when I am surfing anonymous. So the URL may look like: www.example.com/user/login?ReturnUrl=/user/settings My Login action has 2 methods, when for GET and one for POST request types. [AcceptVerbs("GET") public ActionResult ...