asp.net-mvc

How to implement automatic timestamps for record changes (SQL Server)

I am used to using "changed_at" fields in my MySQL database that Ruby on Rails automatically updates when changing a record. Now I am using ASP.NET MVC with SQL Server 2008 and I am wondering, how would I proceed to get the same functionality. Does SQL Server have an option for auto updating a field when updating? ...

Adding a onclick dynamically using an Html Helper in MVC

I need the ability to dynamically set an onclick using an HTML Helper. the below is what I'm trying to do, but i'm getting an obvious syntax error <%=Html.CheckBox("checkboxname", item.Id = 3, New With {.onclick = "ajaxThis(this, <%= Html.Encode(item.ID) %>, '<%= Html.Encode(item.NUMBER) %>');"})%> ...

Strongly-Typed ASP.NET MVC with Entity Framework

This code fails to actually save any changes: // // POST: /SomeType/Edit/5 [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(Guid id, SomeType Model) { db.AttachTo(Model.GetType().Name, Model); db.ApplyPropertyChanges(Model.EntityKey.EntitySetName, Model); db.SaveChanges(); return RedirectToAction("Index"); } ASP...

Custom Binding in ASP.NET MVC - Changing the Binding Behavior on a Single Field

I have a double-precision floating point field in my database that stores seconds past midnight. I have code in c# that can convert this number to the form HH:MM:SS.ffffff, where f is fractions of a second. I also have code that can parse this back into a double. What I would like to do is modify the stock binder object in ASP.NET MVC...

working with multiple contentplaceholders in MVC

hi i have a master page in MVC with multiple contentplaceholders for example: news list, basket preview, offers etc. and these things i want to be throughout the application, but this is my first MVC application and i was wondering if you guys have some sound advice on how to tackle multiple content, from multiple (pages/code) without h...

What to learn - Ruby on Rails or ASP .NET MVC...given that am familiar with ASP .NET

I need to learn and adpot the MVC methodology for building web apps. Which is the better way to go given that I have experience with ASP .NET Webforms - ASP .NET MVC or Ruby on Rails? I've heard people going gaga over RoR and its simplicity and its features such as scaffolding, ActiveRecord, convention over configuration etc. However,...

ASP.NET MVC - jquery datepicker

Ok, so I'm new to ASP.NET MVC and JQuery. I have followed the following example to the letter, and I'm not able to get the datepicker working: http://codesprouts.com/post/Creating-A-DatePicker-Extension-In-ASPNet-MVC.aspx Can anyone tell me if there are any ticks or gotchas with this? Bernard. ...

How to display data in matrix form - Asp.Net MVC

I have one table structure Like 1)Id 2)Date 3)score Filtered by date, I can show number of rows (Display field: Score). and on one page I what to show records of 3 dates (3 consequent dates, Stored in tables). Format should look like.... Date1 Date2 Date3 score score score score score score score score score .....

Upgrade asp.net MVC from Beta to Release 1.0

a) At the moment I have a deployed app on live on asp.mvc beta ... but few days ago it refuses to work with following error: Method not found: 'System.String System.Web.Mvc.Html.LinkExtensions.RouteLink(System.Web.Mvc.HtmlHelper, System.String, System.Web.Routing.RouteValueDictionary, System.Web.Routing.RouteValueDictionary)'. Version ...

Mvc Html.ActionButton

Has anyone written one? I want it to behave like a link but look like a button. A form with a single button wont do it has I don't want any POST. ...

Convert ASP.NET MVC App to Web Site

How would I go about using the MVC framework in the ASP.NET standard web site model, instead of the web application model? ...

How to edit tabular data (ASP MVC)

Hi, I need to be able to edit a table of data in the browser. I have seen in MVCContrib there is a HTML helper to render out a table. Useful... but what about if I want the user to be able to edit that table? From what I can see it does not help there. What is the best way to approach this? Traditional FORM with a TABLE inside? If so...

Alternative User management in ASP.NET MVC

I am in the planning phase of a new ASP.NET MVC application and one of the requirements is storing some user information that is not part of the standard set found in the User class that comes with ASP.NET MVC. I suppose it comes down to two questions. 1) Can I edit the class that is being used already to store the information that I ne...

ASP.NET MVC UI Helper list and documentation

Is there an updated list of the UI Helpers for ASP.NET MVC? I can only find documentation of beta version stuff. I have the source, and I will probably end up looking at that anyway, but it would be nice to have a run down. ...

Trigger change event of dropdown

I want to trigger the change event of dropdown in $(document).ready using jquery. I have a cascading dropdown for country and state in user details page. how can i set the value (which is taken from DB based on the user id) for country and state in MVC with C#. ...

ASP.NET MVC: add to querystring on form submit

Hi guys, I'm building a grid in ASP.NET MVC and I have the following issue: Above the grid i have a column selector which lets people customize the columns being shown. This is a form with a submit button so that people can add/remove multiple columns at once without going trough multiple postbacks. Below the grid I have paging. This ...

Is it possible to have a strongly typed GetVirtualPath method?

Hi Folks, based upon an answer from this SO post, i'm trying to tweak it a bit so that i don't need to hardcode the route and route params, but instead (if possible) use a strongly typed controller action method:- string path = RouteTable.Routes.GetVirtualPath( new RequestContext(HttpContext, RouteTable.Route...

Handle Invalid URL in MVC

How to handle invalid URLs in MVC? For ex.: When the user enters http://localhost/User/MyProfile instead of http://localhost/User/Profile, it will throw an exception. How to handle this request? ...

Redirect to Login Page on some condition of session check

In C# with MVC, i want to write a common utility or class in which if a particular conditoin fails need to redirect to login page. For ex.: When the user logged in to the website, userid will be added to session. To Access the "ManageUsers" page, the user should be logged in as admin, else i need to redirect to Login page. i need to che...

How to post values outside a partial view to controller in ASP.NET MVC?

I am working with a paginated list like in the NerdDinner sample. I am trying to show the navigation buttons for forward and back. I want there to be a form post when these are clicked so that the search text is still passed in. The problem is, the search text is stored in a form that is outside the partial view that the paged list is...