asp.net-mvc

ASP.Net MVC2 -- After posting, how to clear form if user hits Back button?

In my web app, after clicking the Submit button on an ASP.NET MVC form, the user is displayed either an Error screen or a Success screen. In the case of the Error, the user is instructed to click the Back button on the browser and fix whatever they didn't do right and try submitting again. This works fine because when the user clicks ba...

IsessionFactory Issue

I am getting the classic "object reference not set to an instance of a object" error on this line HttpContext.Items["ISession"] = Configure.GetSessionFactory().OpenSession(); My configure.cs file is as follows using System; using System.Collections.Generic; using System.Linq; using System.Text; using FluentNHibernate.Cfg; using Fluen...

How can i recreate a spreadsheet or sharepoint datasheet view on a website ?

I am trying to migrate users off of a sharepoint solution into a website + SQL backend. The one thing is that everyone seems to like the sharepoint view and the data sheet view for editing and managing information. what is the best spreadsheet / access data editing solution. are there any third party asp.net mvc widgets that are good ...

Get DisplayName Attribute without using LabelFor Helper in asp.net MVC

What is the best way to retrieve the display name attribute for an item in your model? I see a lot of people using the LabelFor helper for everything, but a label isn't appropriate if I just want to list the data out. Is there an easy way just get the Name Attribute if I just want to print it out in, say a paragraph? ...

How to send many emails via ASP.NET without delaying response

Following a specific action the user takes on my website, a number of messages must be sent to different emails. Is it possible to have a separate thread or worker take care of sending multiple emails so as to avoid having the response from the server take a while to return if there are a lot of emails to send? I would like to avoid usi...

Generating complex raw xml from asp.net mvc c#

In my ASP.net c# MVC project, I want to get raw XML generated from reading DB. I am getting XML response back, but problem is that my complete XML shows as plain string within my string What should I change to make this response a well formated XML output? Below is what I have got public override void ExecuteResult(ControllerConte...

Help with using jQuery with ASP.NET MVC

My app has a "Show all comments" similar to the one in Facebook. When the user clicks on the "show all" link, I need to update my list which initially has upto 4 comments with all comments. I'll show some code first and then ask some questions: jQuery: ShowAllComments = function (threadId) { $.ajax({ type: "POST", ...

Set the value of an ExtJS ComboBox to an Object, not an object property

I have a ComboBox in an EditorGrid. I am populating it (trying) using JSON, which is produced by serializing an IList<FertilizerType>. I want the valueField of the ComboBox to be equal to the FertilizerType objects and the displayField equal to FertilizerType.Name Here is a Crop: {\"Id\":1300,\"Active\":true,\"Code\":\"Ammonium Bicarbo...

Required Field Doesn't work for one field but does for other

I am using a standard validation with MVC, acrossed with my fluent nHibernate [DisplayName("Product Name")] [Required(ErrorMessage = "Product Name Required")] public virtual string ProductName { get; set; } [DataType(DataType.MultilineText)] public virtual string Description { get; set; } [DataType(DataType.Cur...

When I publish a ASP.NET MVC 3 project my Razor views aren't copied.

Looks like Publish doesn't copy Razor views at ASP.NET MVC 3 Beta. Is it a known limitation of Beta? Will it be fixed at release? ...

Html.TextboxFor default value for Integer/Decimal to be Empty instead of 0

Hey everyone, I am using the default asp.net MVC 2 syntax to construct TextBox's which are integer or decimal for my asp.net MVC web app: <%: Html.TextBoxFor(model => model.Loan.InterestRate) %> pretty straight forward, but the problem is inherently of the fact my binding model objects are decimal or int and non-nullable, they print ...

Facebook auth token and asp.net mvc

Hi We have an ASP.Net MVC site that needs to authenticate to facebook to post photos to a user account. All fine so far. Facebook redirect back to the mvc site. Again fine. The url that facebook replies with include the access_token BUT this is prefixed with a # char and MVC strips this and the token from the url so the controller a...

Form to create or/and remove a many-to-many relation

Ive got 2 tables, "projects" and "devices". They are connected through a many-to-many relation in the table "projectsdevices". I want to create a form where the 2 can be linked together. For example on the project detail page I have a option "link device". The link device page should show all devices that are available and not yet linked...

How to get to the parent object in an editortemplate?

In a custom editor template I want to access the parent object. I'm using this code but this is probably not the best way to do it, especially when using nested views: object parent = ViewContext.Controller.ViewData.Model; Does anybody have a better idea? ...

Database back up from mvc.net application

Hi, I am using VS2010 and working on mvc application. I want to get Database backup from c# code and then want to restore database. If some one has solution then please reply. Thanks & Regards Munish ...

Unable to logout from ASP.NET MVC application using FormsAuthentication.SignOut()

I am trying to implement Logout Functionality in ASP.NET MVC. I use Forms Authentication for my project. This is my Logout code: FormsAuthentication.SignOut(); Response.Cookies.Clear(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, FormsAuthentication.FormsCookieName, DateTime.Today...

How to create a CheckBoxListFor extension method in ASP.NET MVC?

Hi, I know there is a ListBoxFor extension method among the ASP.NET MVC Html helper extension methods, but I always thought that a checkbox list is more user-friendly than a list box. There was a very convenient CheckBoxList control in good old WebForms, but obviously that is out of the picture now. The question is, why is there no wa...

Microsoft.Web.Mvc.LinkBuilder.BuildUrlFromExpression failing when testing Asp.net MVC app

So I'm trying to unit-test a controller method. I'm using MSTest in VS 2010, and Moq 3.1 Test method: [TestMethod] public void TestAccountSignup() { var request = new Mock<HttpRequestBase>(); var context = new Mock<HttpContextBase>(); AccountController controller = new AccountController(); ...

java script Validation related to checkbox and textbox in a gridview

hi, i have a situation where i have to halt a program and for this i need to provide the halt reason.I have a gridview where i can select multiple items by checkbox.i need a java script which will validate that halt reason text box has some text while i click the halt button to halt the selected items.Here is my gridview <asp:GridView ...

Exclude file types in teamcity artifacts

Hi, I'm just about to setup teamcity for the first time on my own. Very nice and simple in most ways I have to say. However, I have one issue that I haven't manage to solve and find any information about. When I wanna publish my artifacts I want to exclude some file types. example: %system.agent.work.dir%\trunk\Source\Projects\Webp...