asp.net-mvc

Is the PRG pattern incompatible with AJAX form posts?

I am using the post-redirect-get pattern for all my forms, but now need to add AJAX functionality to improve the user experience. My initial thoughts are that the two do not mix. In the PRG scenario, I would have my post action that would then either redirect back to my get action if there is a validation error, or redirect to my succes...

ASP.NET MVC 3 Preview 1 -- safe to use?

MVC 3 Preview 1 just released a few days ago. My designer isn't too familiar with C#, so ASPX view pages are sort of overwhelming for him. Razor would really help him focus on the HTML. Considering MVC3 seems to be an incremental compatible update, it feels like it's good to go. Usually it's considered harmful to use preview products ...

how do i have a facebook-like scrolling updates on my website showing all activity

i have an asp.net mvc website with a SQL server backend. For every table i have a "History" table to track all changes (who, when, etc). I can run a query and generate an audit report (view of what has changed including who, when, etc) but i wanted to try to implement a facebook style view that shows a list of updates (instead of a sta...

Avoiding race-condition when manually implementing IDENTITY-like increment for a SQL Server DB column

I'm building an ASP.NET MVC 2 site that uses LINQ to SQL. In one of the places where my site accesses the DB, I think a race condition is possible. DB Architecture Here are some of the columns of the relevant DB table, named Revisions: RevisionID - bigint, IDENTITY, PK PostID - bigint, FK to PK of Posts table EditNumber - int Revis...

Razor view engine - How can I add Partial Views

Hello, I was wondering what, if it is possible, is the best way to render a partial using the new razor view engine. I understand this is something that wasn't finished completely by the time Right now I am using RenderPage to render the user control: @RenderPage("~/Views/Shared/LocaleUserControl.cshtml",ViewData.Model) The page call...

Redirect users to logon page only if not authonticated in asp.net MVC

Hi In my ASP.NET MVC project i have following tag in in web.config file <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="2880"/> </authentication> This causes even the authenticated users but unauthorized resource requested users to redirect to logon page. but i need only to redirect this page if user ...

JsonNetResult not returning S#arp Nhibernate object

Hi, I am having a problem returning a JsonNetResult for an object when it is a property of another object, however when I fetch the object explicitly it works e.g. JsonNetResult res = new JsonNetResult(); res.Formatting = Formatting.Indented; res.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; res.Data = add...

MVC validation of Date using DataAnnotations

This is my Model class public class Model { [DataType(DataType.DateTime, ErrorMessage = "My error message")] public DateTime Day { get; set; } } When I try to input incorrect value for example "notdate" i got the error "The value 'notdate' is not valid for Day." instead of my specified ErrorMessage "My error message". I use A...

how do i get the content of this div using jquery

i want to show a tooltip when i highlight over any text inside of "class=div". I have the following HTML: <div class='test'>Test</div> <div class='tooltip'>Tooltip 1</div> <div class='test'>Test 2</div> <div class='tooltip'>Tooltip 2</div> <div class='test'>Test 4</div> <div class='tooltip'>Tooltip 4</div> and the following javascr...

asp.net mvc dropdown problem

hi, i am getting error after post, when i am using dropdown in my mvc website, the code is as follows ViewData["JobSite_JobCategories1"] = new SelectList(context.JobSite_JobCategories, "Id", "Category", null); <%= Html.DropDownList("JobCategory", ((IEnumerable<SelectListItem>)ViewData["JobSite_JobCategories1"]))%> <%= Html.ValidationM...

How do you fill in a resource string at run-time?

I have an application I'd like to localise. However, the strings to be localised occasionally contain parts I'd like to provide at runtime, such as action links. For example, I have a string like this: Please <a href="/help">click here</a> for help. I can't just split it into two resources since in different languages it'll be in a diff...

Repository Pattern in asp.net mvc with linq to sql

I have been reading though the code of the NerdDinner app and specifically the Repository Pattern... I have one simple question though, regarding this block public DinnersController() : this(new DinnerRepository()) { } public DinnersController(IDinnerRepository repository) { dinnerRepository = repository; ...

MVC organization for a blog

I'm still just getting into MVC, and for my first real project I plan on creating a blog. This will be extremely basic (at least at first). Everything I need is going to be on the same page. Here are the initial features I am shooting for: User should be able to log in, but not register (I will be the only one able to post, and I added...

CQS and ASP.NET MVC Actions

Hello, Those who have read about CQS principle know that: CQS states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. Speaking of ASP.NET MVC Actions, does CQS indicate that we shouldn't have an Action like this? public PartialView InsertOrder(...

window.location.href duplicate url address

public JsonResult UnassToOrder(string location, string article_number) { //.... return Json(new { success = true, redirect = "ImportXML/Index" }); } <script type="text/javascript"> $(document).ready(function() { $('input:radio').click(function() { var location = ...

How to integrate SEO and ensure the performance in Portal Architecture Design ?

I need to develop a Portal for B2C from scratch, right now I faced two problem: 1.How can I integrate SEO into the architecture design ? 2.How to design the architecture to ensure the performance ? I need to revamp a website like this :http://www.airasia.com/bd/en/home.html And why all the enterprise level website are using *.html ? bu...

Jquery datepicker showing previous date in MVC

Hi, I am using the jquery datepicker function on a mvc Html.Textbox, which is bound to my model, the first time I press my search button it gets the correct date in my model, however if I press search again, it should return a different date from the model but it doesn't - it stays cached as the same date that came the first time. I deb...

DropDownListFor - display a simple list of strings

I know there are many similar questions already, but I've spent hours trying to figure this out and none of the other answers seem to help! I want to just display a list of strings in a drop-down list using MVC. Is this really so difficult? I don't have a "Text" and "Value" separation (athough MVC appears to require one) - the string di...

Need suggestion on Database Design

In my web application project i have packages, modules and documents (such as creatememo, createcircular,CreateEmployee). in my database i created tables for packages, associated modules and objects (employee, memo, circular). then i have action table that defines applicable actions on each object e.g create, List, edit, print etc. now i...

Link to SQL and class mapping

Hi Experts, I am new to linq and asp.net mvc and right now i am developing a project based on Asp.net mvc using Linq to sql as a data access technology.But i am very confuse about the way of using linq to sql classes.Is it good practice to create a new class for each entity on dbml file and map between them and use that newly created cl...