asp.net-mvc

How can I not render a button in my view if a given property off my model has no value?

I'm new to web development. In my view, I want to conditionally show a button if Model.TemplateLocation (which is a string) is not null or empty. Below is the code that is rendering the button currently: <div class="WPButton MyButton"> <%=Html.ActionLink(Model.TemplateLinkName, "DownloadTemplate", "ExternalData", new ArgsDownloa...

Can i re-size an image coming from an external server like flickr?

what im trying to archive is to load some images from external servers flickr, but i want to re-size the image before rendering, i want to know if there is any way to load that external image check the size and if its too big then with some c# code do the resizing and then send it to the client? Thx in advance. ...

ASP.NET MVC & Detached Entity won't save

Hey all, I have an ASP.NET MVC POST action for saving an entity on submit of a form. It works fine for insert but doesn't work for update, the database doesn't get called, so it's clearly not tracking the changes, as it's "detached". I'm using Entity Framework w/.NET 4: //POST: /Developers/Save/ [AcceptVerbs(HttpVerbs.Post)] ...

MVC2 client/server validation of DateTime/Date using DataAnnotations

The following are true: One of my columns (BirthDate) is of type Date in SQL Server. This very same column (BirthDate) is of type DateTime when EF generates the model. I am using JQuery UI Datepicker on the client side to be able to select the BirthDate. I have the following validation logic in my buddy class: [Required(ErrorMessage...

Is there a certain IIS configuration required to allow a functioning .Net 4.0 ASP.Net MVC 2 Azure application?

I just installed the Azure 1.2 tools update and would like to get to work on an Azure project running locally using ASP.Net MVC and .Net 4, but I cannot get MVC pages to load. If I just create a new Azure project in VS 2010, add a ASP.Net MVC web role, and run the application, pages never load. It appears that routing is somehow at f...

How to add sort function for the table via ajax in ASP.NET MVC?What is the best practice.

How to add sort function for the table via ajax in ASP.NET MVC?What is the best practice. If not use Ajax, it maybe much easier, just return View, but if use AJAX, what data structure should return?I just use Json to return the data, but i found each JSON data model return to the client browser, the JS have to use different code to p...

form data posted using linq-to-sql not showing until I refresh the page

I have an asp.net mvc app with a form. When you submit the form, it adds records to the sql database with linq-to-sql. After adding the records, the controller displays the form again, and should show those new values on the form. But, when it displays the form, the values are blank, until you refresh the page. While tracing through ...

Step by step(screen shots) setup of nhibernate with asp.net mvc...

I am interested in looking for Step by step(screen shots) setup of nhibernate with asp.net mvc.... Any good links would be really useful... ...

getting started with Fluent nHibernate and asp.net MVC..

I thought of using Fluent nhibernate for data access with my asp.net mvc web application...Any good article that describes about the setup of Fluent nHibernate with asp.net MVC web application... ...

How can I create a horizontal table in a single foreach loop in MVC?

Is there any way, in ASP.Net MVC, to condense the following code to a single foreach loop? <table class="table"> <tr> <td> Name </td> <% foreach (var item in Model) { %> <td> <%= item.Name %> </td> <% } ...

Model binding difficulty

I am having a model and I am using ajax.post. I can see that the model binding isn`t being done for the arraylists in my model, though binding done for the properties of int or string type. Why is that so? My code is as below. I have a model with the following properties public class ProjectModel { public int ID { get; set; } ...

Where to place the management session in a MVC pattern ?

I've Application based on MVC architecture. - WEBproject - BLLproject - DALproject In the web I use class "commands" attached to the pages "views" aspx. I use a gridview connected to a ObjectDataSource (ods) with data stored in session. the ods uses methods update, insert, delete to query a list of objects stored in session. My probl...

How to submit Nothing as a route value to ASP MVC

I have a route with several optional parameters. These are possible search terms in different fields. So, for example, if I have fields key, itemtype and text then I have in global.asax: routes.MapRoute( _ "Search", _ "Admin.aspx/Search/{Key}/{ItemType}/{Text}", _ New With {.controller = "Admin", .action = "Sea...

ASP.NET MVC: Why can't I set ShowForEdit model metadata with an attribute?

Why can't I set ShowForEdit model metadata with an attribute? It seems that the only attribute provided to alter this is [ScaffoldColumn], which sets both ShowForEdit and ShowForDisplay, which is not what I want to do. I want to be able to annotate the two separately from on my model. ...

ASP.NET MVC Application performance profiling

How are people currently profiling the performance of their ASP.NET MVC applications? I'd be most interested in simple and free approaches. ...

Use of IsAssignableFrom and "is" keyword in C#

While trying to learn Unity, I keep seeing the following code for overriding GetControllerInstance in MVC: if(!typeof(IController).IsAssignableFrom(controllerType)) { ... } this seems to me a pretty convoluted way of basically writing if(controllerType is IController) { ... } I appreciate there are subtle differences between is and...

Set a ModelState to an ActionResult in ASP.Net MVC

Hi, In a View, I've created a <form> that posts some data to another Controller, which is different from that one that redirected me to the View. In this second controller, i perform some data validations and then, if errors are found, I need to redirect the user again to the source View but with the edited ModelState (so that i can sho...

setting up Fluent NHibernate with asp.net mvc...

I am in search of a tutorial which leads through the setup of Fluent Nhibernate in an asp.net mvc web application... Any good tutorial.... ...

ASP.NET MVC 2 - do UrlParameter.Optional entries have to be at the end of the route?

I am migrating a site from ASP.NET MVC 1 to ASP.NET MVC 2. At the moment, the site supports the following routes: /{country}/{language}/{controller}/{action} /{country}/{controller}/{action} /{language}/{controller}/{action} /{controller}/{action} The formats for country and language are distinguishable by Regex and have suitable cons...

Any known orchard cms case studies ?

Hi, We're looking into using orchard cms for a project. I know the CMS hasn't been around for a long time, but I was wondering if there were any known high profile and successful case studies using orchard cms or its predecessor Oxite ? Thanks. ...