asp.net-mvc

asp.net mvc HttpPostedFileBase getting file extension

public string ContructOrganizationNameLogo(HttpPostedFileBase upload, string OrganizationName, int OrganizationID,string LangName) { var UploadedfileName = Path.GetFileName(upload.FileName); string type = upload.ContentType; } I want to get the extension of the file to dynamically generate the name of the file....

Inheriting from ViewPage forces explicit casting of model in view

I try to inhering from ViewPage as shown in this question http://stackoverflow.com/questions/370500/inheriting-from-viewpage But I get a Compiler Error Message: CS1061: 'object' does not contain a definition for 'Spot' and no extension method 'Spot' accepting a first argument of type 'object' could be found (are you missing a using...

How can I 'transpose' my data using SQL and remove duplicates at the same time?

I have the following data structure in my database: LastName FirstName CourseName John Day Pricing John Day Marketing John Day Finance Lisa Smith Marketing Lisa Smith Finance etc... The data shows employess within a business and which courses they have s...

How to turn off https security risk related messages on ASP.NET MVC page?

Hi We have a secured website using ASP.NET MVC Framework. The User session timeout is implemented using JQuery IDLETIMEOUT plugin. So that If the session timeout is set for 30 min, it displays a message "You are about to be Signedout due to inactivity" with "Stay Logged on". This popup Message displays for last 30 sec and if the user c...

Creating custom model using other models in ASP.NET MVC

As the title suggests I have two models Products And Orders which are actually two table in my database and I have used a LINQ to SQL class to create there models. Now I wan to create a model named "OrderDetails" which will have properties from both the model like product name and id from product and Order number from orders something li...

Model binding nested collections in ASP.NET MVC

Hi I'm using Steve Sanderson's BeginCollectionItem helper with ASP.NET MVC 2 to model bind a collection if items. That works fine, as long as the Model of the collection items does not contain another collection. I have a model like this: -Product --Variants ---IncludedAttributes Whenever I render and model bind the Variants colle...

How to reference other Areas?

Hi, I have a controller called "Account" in my main site and I would like to reference a method on it from with in an Asp.net MVC 2 Area. It seems by default that Areas only have access to the controllers within that Area which makes sense, but there doesn't seem to be an option to reference controllers from another area. Thanks! ...

ASP.NET MVC 2 - How can I get the selected value from a drop down into my view model?

I'm creating a drop down via <%= Html.DropDownList("data.Language", Model.LanguageOptions) %> and want to read back its value through automatic model binding into my LanguageModel viewmodel: public ActionResult Save(LanguageModel data) However, data.Language is null when the Save method is called. How do I get the selected value f...

How to intercept 401 from Forms Authentication in ASP.NET MVC?

I would like to generate a 401 page if the user does not have the right permission. The user requests a url and is redirected to the login page (I have deny all anonymous in web.config). The user logs in successfully and is redirected to the original url. However, upon permission check, it is determined that the user does not have the...

ASP.NET MVC 2 - ViewData empty after POST

I don't really know where to look for an error... the situation: I have an ASPX view which contains a form and a few input's, and when I click the submit button everything is POST'ed to one of my ASP.NET MVC actions. When I set a breakpoint there, it is hit correctly. When I use FireBug to see what is sent to the action, I correctly see...

DataAnnotations - Disallow Numbers, or only allow given strings

Is it possible to use ASP.NET MVC 2's DataAnnotations to only allow characters (no number), or even provide a whitelist of allowed strings? Example? ...

ASP.net MVC Routing on Postback

In my ASP.net MVC View I have a dropdown that I want to get details on selection and asynchronously update a div. My aspx is as follows: <% using (Html.BeginForm("Index", "Portal", FormMethod.Post, new { id = "TheForm" })) {%> <h2>Index</h2> <% using (Ajax.BeginForm("Details", new AjaxOptions { UpdateTargetId = "mpkRes...

Conflict between Jquery Validate and Asp.net MVC

Hi I am using asp.net mvc 2.0 and jquery validate 1.7 (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) What happens is this. A user can click on a link to edit a product. When a user clicks on which product they want to edit a jquery dialog box appears with a form of textboxes and dropdown lists. These html controls ha...

How to loop through the FormCollection to check if textboxes have values?

Hi there. I have a search page that has 6 textboxes which i pass as FormCollection to the action in the controller. I dont want to search for records if ther is no values in textboxes. Is there a way to loop through all textboxes in FormCollection to check which ones have values in them? I am a student in the college and this project ...

Custom JsonSerialization

Hi, I have a simple class in asp.net mvc that looks like this: public class JsonResponseItem { public string Key { get; set; } public string Value { get; set; } public JsonResponseItem(string key, string value) { Key = key; Value = value; } } In my controllers I create a list of that type Li...

How to build a search engine in C#

I am trying to build a web application in ASP.NET MVC and need build a pretty complex search feature. When a user enters a search term I want to search a variety of data sources which include documents, tables in the database, webpage urls and some APIs like facebook. Any tips, tutorials and hints would be greatly appreciated. ...

Question about Architecture for Viewing Images in ASP.NET MVC App

I have an approach in mind for an image viewer in a web app, and want to get a sanity check and any thoughts you stackoverflowers might have. Here's the whirlwind nutshell summary: I'm working on an ASP.NET MVC application that will run in my company's retail stores. Even though it is a web application, we own the store machines and hav...

MVC Project for review

I am very close to completion of a mvc project which I want to make public. I want people to review my codes and give me the feedback, so that I can improve my codes and make this project better. I will put this code on codeplex or at some other repository soon. Or is there any better way to get it reviewed. Also I havent written any...

Question about OOP and objects.

I have a school assignment: a Dog Show. My assignment is to create a website, where vistors can display results, and where Judges and Secretary can admin and CRUD. I have a small problem, one part of the assignment: the result should be based on two decisions from different judges, and after that checked by the secretary, before the re...

ASP.NET MVC Routing, "bin" as a route parameter value

Hi everybody, We are developing an English-Turkish dictionary website. "Bin" means "Thousand" in Turkish. So when a user asks for http://tureng.com/search/bin we should show her the meaning of "Bin" in English. However, since /bin is a special directory, she got a 404. Any ideas to solve it? Thanks. ...