asp.net-mvc

MVC: Just me or is IsValidField illogical

While I was writing some code to print out JS when a field is not valid in the ModelState is came to the following method: ModelState.IsValidField(string key) The comment in IntelliSense tells me: Returns true if there is any System.Web.Mvc.ModelError associated or prefixed with the specific key. While I ask whether a field is ...

asp.net mvc binding string to ienumerable<int>

Hi all, just wondering if there is something built into asp.net mvc where I can override how a specific member is bound. For example, imagine I have a form: <form ...> <input type="text" name="Things" /> ... </form> And I have the controller action that handles the postback: public ActionResult MyPostbackAction(IEnumerable<int> ...

Redirect to controller/view when dropdownlist changed

Hi, ASP.NET MVC application. I have a Html.DropDownList. I want to redirect to another controller when the selection is changed, and want the key of the selected dropdownlist item as a param in the URL. How should I go about this? Thanks ...

Can I have more than one "Details" ActionResult in a controller?

I have a Controller called TicketsController.vb, with an action result of: ' ' GET: /Tickets/Details/5 Public Function Details(ByVal id As Integer) As ActionResult ViewData("OpenTixCount") = ticketRepository.countOpenTickets.Count() ViewData("UrgentTixCount") = ticketRepository.countUrgentTickets.Count() ViewData("HighTixCou...

Entity Framework - How to handle table relationships?

I have developed a fairly small asp.net MVC application using the repository pattern and Linq to Sql. I would now like to access and update the same data using the Entity Framework, however I am having trouble understanding if my syntax is correct for table relationships in the Entity Framework. Say I am retrieving a row of data for a ...

Asp.Net MVC project "not supported by this installation"

I can create new MVC projects and they work and run however trying to open an existing project is not working at all I tried the following Changining the project type to {F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} (this worked on migrating a project from Asp.Ne...

Asp.Net MVC OnSessionStart event

Hi, I have found this thread which describes a very interesting OnSessionStart event, but I am unable to "hook" it up (whatever it means) to my global.asax.cs. I am also unsuccessful while searching the web for it. So could someone please explain to me, if the event really exists in asp.net mvc, where do I get it (inherit or what from wh...

<%= How to write out a String MVC.Net

In ASP.NET MVC, if I have some content on the page I can do the following: <%=Html.ActionLink(..Blah Blah..)%> How can I acheive the same result in the following block: if(a==b) { Html.Encode("output some text here"); } I want to do this without a lot of tags, hence why I am asking. ...

ASP.Net MVC: Render Html.ValidationSummary only if there are errors

Html.ValidationSummary() is still being rendered even if the model state is valid. This example doesn't work: <% if (!this.ViewData.ModelState.IsValid) { %> <%= Html.ValidationSummary()%> <% } %> There is still an empty 'ul' tag being rendered. How do I make it render only if the ModelState is not valid? EDIT Turns out the ModelSta...

Asp.Net MVC Validation

Ok I've spent a lot of time reading all the various blog posts on Validation. We are currently in the middle of writing an app in MVC 2.0 and noticed the Model Validation Providers, can anyone provide any examples or links to good solid examples? Cheers ...

Validation in the business logic - ASP.NET Web Forms

In reading up on ASP.NET MVC I came across some wonderful examples of validation where the business rules were associated with the model and the UI merely displayed the set of errors and flagged the form elements associated with invalid input. I think it makes fantastic sense to keep this logic in a single place rather than have every f...

$.ajax( { async : false } ) request is still firing asynchronously?

I got a little problem here guys. I'm trying to implement the following scenario: 1- A user opens the home page and sees a list of other users and clicks to add one to his friend list. 2- I issue an Ajax request to a server resource to validate if the user is logged in, if so, I issue another ajax request to another server resource to ...

"This property setter is obsolete, because its value is derived from ModelMetadata.Model now."

http://www.asp.net/learn/mvc/tutorial-39-cs.aspx We are using the above guide to implement some validation in our ASP.NET MVC app. We receive the following error This property setter is obsolete, because its value is derived from ModelMetadata.Model now. which does not have a line number, it simply explodes when pressing the submit but...

ASP.NET MVC 2 Preview 1 To Preview 2 Migration

How do you "convert" a current project from one version to another in ASP.NET MVC 2? I'm using Preview 1 but want to move to Preview 2. I've never known how to do it correctly, and I don't want to re-create a project and go from scratch again with everything I've got preferably. Any ideas? ...

ASP.NET MVC - Form Value display by role

Exact duplicate: ASP.NET MVC - Form Value display by role I'm looking for an ideal way for my input forms to either show as a textbox (editable), label (readonly), or hidden (no access) based on the roles. I know I could have a different view for each type of role but I was hoping that there's some new goodness out there that would pre...

Why is my ActionLink not generating properly?

I can not figure out why ActionLink is not generating the url correctly in this one instance. I have a controller called Activity and a view called Show. From there I'm trying to create a link to the ServiceCall controller, Show view. From within any view on the ServiceCall this works fine: <%= Html.ActionLink(Html.Encode(sc.CallNu...

ASP.NET MVC - Form Value display by role

I'm looking for an ideal way for my input forms to either show as a textbox (editable), label (readonly), or hidden (no access) based on the roles. I know I could have a different view for each type of role but I was hoping that there's some new goodness out there that would prevent me from having to do 80 views. ...

Hide axd resources in asp.net MVC application

The title say it all, how can i hide the axd, or simply rewrite the url into something else to hide the axd file. the reason for this, i think you all know. Thank you ...

Sharing ASP.NET MVC partial views between projects

What is the best way to share a common Partial View between applications? I've created a separate assembly containing my Partial View in an ascx file, some scripts that go with that view and an HtmlHelper extension method to make creating the partial view easier. However, when referencing that assembly from an ASP.NET MVC application, i...

Loading Partial View from JQuery not showing in MVC.

Hi I am having problem getting my partial view to render in ASP.Net MVC 1.0 when I load it with JQuery. I have a controller like: public ActionResult Index() { return View(_invoiceService.FindAllInvoices()); } public ActionResult InvoiceSearchResults() { return PartialVie...