asp.net-mvc-2

Entity Framework CTP4 Modeling and mapping question/problem

I have a site where users are allowed to create as many micro-sites with in the main site as they like. A user can also set other users as moderators of their micro-site and users can follow other micro-site. I am not sure what I am doing wrong, (this seemed to work with CTP3), but when I try to do simple stuff like var site = _siteRep...

Format HTML prior to serving the page

Hey There I am using ASP.NET-MVC, and would like to format my html prior to sending it to the browser. I have one page with multiple partialviews, and i want it all to be indented nicely. I know this is stupid, but while in development it's nice to have well formatted html when you go: RightClick -> View Source. Does anyone know of a...

ASP.NET MVC 2 How to pass JSON to ASP.NET Controller Action

Wondering if there is a better way to do this with ASP.NET MVC2. The following Posts on SO are little dated: http://stackoverflow.com/questions/267707/how-to-pass-complex-type-using-json-to-asp-net-mvc-controller http://stackoverflow.com/questions/560575/asp-net-mvc-how-to-pass-json-object-from-view-to-controller-as-parameter and also...

Jquery ajax call: how to parse results?

I have a modal dialog (done through jquery UI) that submit a form to a remote controller Action. This is the jquery function called: $("fpForm").submit(function() { $.ajax({ type: "POST", url: "ForgotPassword", data: $("#fpForm").serialize(), success: function(response) { alert(response);...

Strange behaviour in ASP.NET MVC2 views and partial form

I'm implementing the MS NerdDinner app in ASP.NET MVC 2 and I'm using google maps instead of MS maps. I use sample code from the google site for the maps. I have 2 very simple views, Create.aspx and and Edit.aspx in the same directory, which create and edit dinners respectively. They are very simple - they both render a partial view name...

ASP.NET MVC - How can I set the Default Value in a Strongly Typed TextArea?

I'm trying to make a TextArea have a default value. <%: Html.TextAreaFor(Function(model) model.Description, 5, 10, New With {.Value = "Description: "})%> This works properly in a TextBoxFor but doesn't work in a TextAreaFor Am I missing something very obvious? ...

How does ASP.NET know the previous input when posting a form

When a user goes to register on my site and if they enter wrong information it redirects them back to the same page to correct any mistakes on the login page. When they are redirected the username and other information they entered previously is in the form fields. Why is this - not that it is bad or anything but i would like to modify t...

ASP.NET MVC. Pdf generation. Put image to PDF file.

I have PDF file and i need dynamically put image(logo) in some place of this pdf file. I just need to say "here is image put it to special position on pdf or something and give me output". And than i pass this output in my controller in response. That's it. Could anybody suggest any good free library for such case. iTextSharp? ...

Caching Strategy for ASP.NET MVC / GeneratedImage

Hi guys, I'm currently developing an image viewer using asp.net MVC. The image viewer itself works as a charme, but I'm not happy with the caching. To explain: I'm using the GeneratedImage (http://aspnet.codeplex.com/releases/view/16449) in order to produce the thumbs, but the Server Side Caching is only limited to 5 Minutes and can't ...

ASP.NET MVC2: Help building admin site and routing

Hello, I'm building a web app (front-end and admin section). There are 4 main record types (books, cars, houses, deals). The user can do query and see the detail of each record type, the admin can do query as well and in addition can edit and delete. Front end controller: each record type has the following actions // // GET: /{reco...

asp-net MVC2: <div> tag - "float: left;" - Problem?!

Problem with <div> tags Works fine: Text "Whatever" is in column 1, followd by a radiobutton: Works also fine (no radio button with text): The next cell AFTER the text "Whatever" should be displayed in column 1 of the next row - instead directly under the text. Background: The table structure is made by my html helper. He genera...

Multi-Tenant in windows azure asp.net MVC2

Hello, Anyone knows how can i start to develop a multitenant site in MVC2, in a way it run on Windows Azure? I search a lot about this question, and i allways find theoric explanations, everybody says it can be easily done, but i dont find any sample... Can someone explain me where to start? Thanks, João ...

get textbox Array from asp.net mvc generates page

Hi guys, My problem is that i have a dynamic loop in which i generate 5 textboxes and now i need get the data of each index because i want to send by in a array to the controller. Can anybody tell me how i get the values from the textbox arrays. All textboxes have the same name and id but they have an index. ...

Upload image / file in asp.net MVC 2

How to create the environment to select the image file and upload it in asp.net MVC 2 ? What code I have to be write for this ? Which scenariois better out of : Store image in database or keep copy of image in file system at application domain and maintain its path in DB ? what code have to write in asp.net MVC 2 for preferred scenario...

Capturing view model properties after form submit

I have a strongly typed view that is using a viewmodel I created. I have a date field in my viewmodel that is a formatted display of a property of my main model. In the POST Edit action (I followed the nerd dinner tutorial) parameters are int id, FormCollection collection. Using my repository I lookup the model off of ID and I am left to...

MVC2 Custom HTML Helper and <%: %> Syntax.

Is there any way to use a custom html helper with the <%: %> syntax ? I know that if i'm use the code below, it's ok, but it's seems not so elegant and secure. <%= Html.MyHelper("Some Data")%> I mean, use <%= %> is the best practices? ...

Bind a list with nested list

Hi, i've got this code Model public class PdfPage { public IEnumerable<PdfPhoto> Photos { get; set; } } public class PdfPhoto { public string path { get; set; } } View <ul> <li> <%= Html.Hidden("ListPages[0].Photos[0].path", "/public/pdfMaker/4_e.jpg")%> <%= Html.Hidden("ListPages[0].Photos[1].path", "/public/pdfMaker...

Refactoring a form in MVC2

I find myself pasting this code over and over on many views that deal with forms. Is there a simple approach to refactor the following markup from a view in MVC2? The only changing part is the route for the cancel link (LocalizedSaveButton and LocalizedCancelLink are helper methods I created). I tried extracting it to a PartialView but I...

JQModal MVC 2 validation

Hi: I am using jqModal to allow users to create new contacts from a list by poping a jqModal window, but can't seem to get any validation to work within the modal window. I know that the form is failing because in the contoller the model state is invalid and when I re-render the form nothing shows. I am using ajax events to close the mo...

ASP.NET mvc 2 - binding a birth date with drop downs

In ASP.NET MVC 2, how would you go about binding a view model property that is a DateTime where the application must have 3 drop down lists for choosing month, day, year?I've read Scott H.'s blog post about binding dates some time ago, and that seems entirely too convoluted for such a simple case. Surely there's a cleaner / better way to...