asp.net-mvc-2

Struturemap in static context

I'm using a custom route in my mvc application that inherits from RouteBase. In my global.asax I register the route like this: routes.MapPageRoute("PageRoute", ObjectFactory.GetInstance<IRepository>()); In the GetRouteData method I use my repository to fetch the correct page and then I put that in the RouteValueDictionary like this: ...

trying to make an MVC EditorTemplate for a Bool that renders a DDL with True or False

I am making an MVC EditorTemplate for the bool data type that will render a drop down list with options True or False, AND set the selected value to the value of the Model. The DDL renders but it's not being set to the value of the model. What am I missing here? Here is my view code: <%:Html.EditorFor(model => model.Association.Activ...

Best technique to add selected class to list

if in the Site.Master file we have something like <div id="menu-container"> <ul id="menu"> <li> <%: Html.ActionLink("Frontpage", "Index", "Home")%></li> <li> <%: Html.ActionLink("Content", "Index", "Content")%></li> <li> <%: Html.ActionLink("Winners", "Index", "Winners")%><...

ASP.NET MVC ModelState IsValid

I'm a nub in MVC.I've a Model: public class Usuarios { [Required(ErrorMessage = "**TxtOPID is required")] public string TxtOpID { get { return this.txt_opId; } set { this.txt_opId = value; } } [Required(ErrorMessage="**Password is required")] public string TxtPa...

MVC application gives an error with routing

I installed a MVC app on one of the machines and it works great. With the same code base, when I install it on a different machine, I get the following error: A route named "myroute" is already in the route collection. Route names must be unique This makes me want to say something is not correctly installed on the the second machine....

Storing a users OpenID and how to handle different provider urls

Hi, I'm exploring OpenID for a new "hobby" project. Mostly just to learn how it works and have downloaded the DotNetOpenAuth samples and looked at the Nerddinner implementation. And I have a couple of questions. What do you store locally to identify returning users (role management, their posts, whatever)? What I see is people using t...

ASP.NET MVC2 Application's submit button returns URL with an appended "Form"

OK, I'm sorry if the tile of the question was unclear, and if you understand what I mean, please don't hesitate to help me think of a better one. Anyway, I have a <input type="submit"> element for my form, and I want it to return the same URL as the URL of the page the element is on. Currently, if I click the button, it takes me from /...

ASP.NET MVC Application not calculating, n00b question

OK, I have a problem where my calculation never takes place, like it is supposed to. i'm trying to make a computation which solves for the roots of a quadratic equation using the quadratic formula, based on the values of a, b and c entered in a primitive form. Now, let me supply the code for my Model, view and Controller for this appli...

How to synchronize an online ICS file with Outlook?

I have been working on a project that required publishing of a set of appointments from my ASP.NET MVC application to outlook. I handled this by creating a controller that returns an ICS formatted file back. So far so good. When I import this calendar in Outlook, it is read-only. What I want to achieve is to be able to update (add/modi...

How to deploy updates in asp.net mvc application

Hi I have developed the asp.net mvc 2 application. I have deployed it successfully on XP machine that having the IIS 5.1 . it is running fine. but I have updated some changes in my application on development machine . I want to deploy only these updates over the deployment machine that is XP machine. means only want to update existing ...

datetimepicker jquery script is not running after deployment of asp. net mvc 2 application

Hi, I have deployed asp.net mvc 2 application successfully. but let say there is view fro create user where I used code for datetime picker : <script type="text/javascript"> $(function() { $('#DateOfBirth').datepicker({ dateFormat: 'dd/MM/yy', changeMonth: true, changeYear: true }); }); ...

Can I use LabelFor() when the page inherits from IEnumerable<T>?

Hello, Let's say, I've the following class definition: public class Person { [DisplayName("First Name")] public string FirstName { get; set; } [DisplayName("Last Name")] public string LastName { get; set; } } And, I'd like to use LabelFor(x =>x.FirstName), and so on. Unfortunately, the page inherits from IEnumerable<T> so ...

check whether user created successfully or not in asp.net mvc 2.0

Hi friends,i have created a new user using custom membership provider in asp.net mvc 2.0.It is created the user successfully.But now i want to check whether it is created successfully or not .If it is created successfully i want to redirect it to other page ,if not i will remain in the same page.please tell me how to do this and this log...

datetime not accepting by asp.net mvc 2

Hi, I have application in asp.net mvc 2. one of form in create user. but this form is not accepting date format of dd/MM/yyyy and MM/dd/yyyy i want to allow MM/dd/yyyy for save in db what have to do. i am am using c# language . ...

MVC 2 Validation logic

I am new to MVC.Just would like to start do some business logic to enforce validation.Is there any simple example to understand how to apply validation? ...

Add Textbox on button click

In my scenario I am building a tree structure. There are three buttons: Button number 1 - for adding parent node Button number 2 - for adding child node Button number 3 - for removing it There is a textbox which is entering the parent node. When user enter a parent node and click on button number 2 then a textbox should come under...

How to get all object (in relation) while saving in Fluent nHibernate .net mvc application

I have pasted all the code below. The problem is when I try to save or update Town Entity, County Title comes null and Model State becomes false. Could you suggest me a way to get complete county Object here while saving Town. Could you also suggest me better flent nHibernate mapping in this case, please? I have following classes and m...

Sharepoint 2010 Foundation with .Net Framework 4.0

Hi All, I am having a Web Application with build target as .Net Framework 4.0. I want to interact with the Sharepoint Object Model API's but it gives a framework 4.0 runtime does not supports Sharepoint.dll error. Is their any tweak such that I can use Sharepoint 2010 with .Net Framework4.0. Note: I cannnot change the build target of ...

What does the tick mark `1 in the file name mean within the ASP.NET MVC source code?

Looking in the ASP.NET MVC 2 source code there are several files in the System.Web.Mvc project that have an almost identically named file except for the `1 on the end of the file name. For example, there is HtmlHelper.cs and HtmlHelper`1.cs. Another example is AjaxHelper.cs and AjaxHelper`1cs. At first glance, the obvious answer is t...

jQuery Grid for ASP.Net MVC2

Hi, I need to choose a jQuery data grid plugin that plays well with MVC2. I sit firmly on the client side so know nothing of MVC2 so was wondering if any had any particularly good or bad experiences in MVC2 with either of the following: Datatables Flexigrid jqGrid The following functions are required: Free to use commercially Col...