Search Results

Search found 9394 results on 376 pages for 'mvc scaffolding'.

Page 29/376 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Why does not Asp.net mvc application work on Asp.Net Classic Application Pool?

    - by Amitabh
    I have an Asp.Net MVC 2 web application deployed on IIS 7.5 on .Net 4.0. When I select application pool as Asp.Net v4.0 Classic I get the following error. HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. The same application works fine when I select application pool as Asp.Net v4.0 Integrated. Does anyone know what is the reason for this?

    Read the article

  • SparkViewEngine, RenderAction and Areas with ASP MVC 2 Beta?!

    - by scooby37
    I just ran into trouble with the AreaDescriptionFilter of Spark using MVC 2 Beta. The following line is from my Application.spark file. It results in the view engine looking in all possible locations of the view - except in the folders of the area "Shell". # Html.RenderAction("ShowMainMenu", "Navigation", new { area = "Shell" }); Running the same action using http://localhost/Shell/Navigation/ShowMainMenu executes fine and recognizes the area's view directory as expected. Any ideas how to fix this?

    Read the article

  • Can you overload controller methods in ASP.Net MVC?

    - by Eric Brown
    Im curious to see if you can overload controller methods in ASP.Net MVC. Whenever I try, I get the error below. The two methods accept different arguements. Is this something that cannot be done? The current request for action 'MyMethod' on controller type 'MyController' is ambiguous between the following action methods:

    Read the article

  • How do I create a simple seach box with a submit button to bring back a result set in MVC?

    - by RJ
    I am very new to MVC and just learning the basics. I have been following along in Nerd Dinner and used the demo as a way to create my own app. I have created a page that lists out some food items with calories, fat, protein,etc... (http://rjsfitness.net/CalorieList) This is one of my own personal sites that I set up to test out MVC. I got a lot of it working but I am stuck on the textbox with a search button. My view page has this code for the search: <form action="/CalorieList/Search" method="post" id="searchForm"> <input type="text" name="searchTerm" id="searchTerm" value="" size="10" maxlength ="30" /> <input type ="submit" value="Search" /> </form> My global.asax has this code for the routing: routes.MapRoute( "Search", // Route name "CalorieList/Search/{searchTerm}", // URL with parameters new { controller = "CalorieList", action = "Search", search = "" } // Parameter defaults ); My Controller has this code: public ActionResult Index(int? page) { const int pageSize = 10; //load a list with the calorie list var calorieLists = calorieListRepository.GetAllCalorieLists(); //var paginatedCalorieLists = calorieLists.Skip((page ?? 0) * pageSize).Take(pageSize).ToList(); var paginatedCalorieLists = new PaginatedList<CalorieList>(calorieLists, page ?? 0, pageSize); return View("Index", paginatedCalorieLists); } public ActionResult Search(String searchTerm) { const int pageSize = 100; int? page = 0; var calorieLists = calorieListRepository.GetCalorieListsBySearch(searchTerm); var paginatedCalorieLists = new PaginatedList<CalorieList>(calorieLists, page ?? 0, pageSize); return View("Index", paginatedCalorieLists); } return View("Index", paginatedCalorieLists); } When I enter a value and click the button, the Index method fires instead of the Seach method in the controller and I get the full list again. If I manually type the url (http://rjsfitness.net/CalorieList/Search/choc) I get the right listing. Why isn't my button click using the right routing and giving me the search results?

    Read the article

  • ASP.NET MVC Route based on Web Browser/Device (e.g. iPhone)

    - by Alex
    Is it possible, from within ASP.NET MVC, to route to different controllers or actions based on the accessing device/browser? I'm thinking of setting up alternative actions and views for some parts of my website in case it is accessed from the iPhone, to optimize display and functionality of it. I don't want to create a completely separate project for the iPhone though as the majority of the site is fine on any device. Any idea on how to do this?

    Read the article

  • How to implement a caching model without violating MVC pattern?

    - by RPM1984
    Hi Guys, I have an ASP.NET MVC 3 (Razor) Web Application, with a particular page which is highly database intensive, and user experience is of the upmost priority. Thus, i am introducing caching on this particular page. I'm trying to figure out a way to implement this caching pattern whilst keeping my controller thin, like it currently is without caching: public PartialViewResult GetLocationStuff(SearchPreferences searchPreferences) { var results = _locationService.FindStuffByCriteria(searchPreferences); return PartialView("SearchResults", results); } As you can see, the controller is very thin, as it should be. It doesn't care about how/where it is getting it's info from - that is the job of the service. A couple of notes on the flow of control: Controllers get DI'ed a particular Service, depending on it's area. In this example, this controller get's a LocationService Services call through to an IQueryable<T> Repository and materialize results into T or ICollection<T>. How i want to implement caching: I can't use Output Caching - for a few reasons. First of all, this action method is invoked from the client-side (jQuery/AJAX), via [HttpPost], which according to HTTP standards should not be cached as a request. Secondly, i don't want to cache purely based on the HTTP request arguments - the cache logic is a lot more complicated than that - there is actually two-level caching going on. As i hint to above, i need to use regular data-caching, e.g Cache["somekey"] = someObj;. I don't want to implement a generic caching mechanism where all calls via the service go through the cache first - i only want caching on this particular action method. First thought's would tell me to create another service (which inherits LocationService), and provide the caching workflow there (check cache first, if not there call db, add to cache, return result). That has two problems: The services are basic Class Libraries - no references to anything extra. I would need to add a reference to System.Web here. I would have to access the HTTP Context outside of the web application, which is considered bad practice, not only for testability, but in general - right? I also thought about using the Models folder in the Web Application (which i currently use only for ViewModels), but having a cache service in a models folder just doesn't sound right. So - any ideas? Is there a MVC-specific thing (like Action Filter's, for example) i can use here? General advice/tips would be greatly appreciated.

    Read the article

  • How to perform an event on Textbox focus in ASP MVC?

    - by NewbieProgrammer
    I have three textboxes A, B and C in create user view. When user enters some text in textbox A and B, and then when he enters textbox C, I want to display the text of textbox A + text of textbox B in C with "-" in between. For example, He enters "ABC" in textBox A and then he enters "123" in textBox B. Now upon entering textBox C (focus event), I want to display "ABC - 123 - " in textBox C. "-" are added through code. How do I do that in MVC ?

    Read the article

  • ASP.NET MVC app on IIS7 with WebForms content is throwing NTLM authenticate box

    - by Jon
    I have an ASP.NET MVC app that also contains some WebForms content (for SSRS ReportViewer). This is deployed to IIS7 and the MVC pages of the app work fine, but when I try to browse to the aspx page I am prompted with the NTLM auth box. I do not have NTLM enabled, I only have Anonymous auth enabled. I have this deployed and fully working on an IIS6 box, the only other difference is that the IIS6 box is in our company domain, but the IIS7 box is not (I fail to see how this could be the issue as the MVC stuff is working fine). Any thoughts? Thanks.

    Read the article

  • ASP.NET MVC 2 "value" in DataAnnotation attribute passed is null, when incorrect date is submitted.

    - by goldenelf2
    Hello to all! This is my first question here on stack overflow. i need help on a problem i encountered during an ASP.NET MVC2 project i am currently working on. I should note that I'm relatively new to MVC design, so pls bear my ignorance. Here goes : I have a regular form on which various details about a person are shown. One of them is "Date of Birth". My view is like this <div class="form-items"> <%: Html.Label("DateOfBirth", "Date of Birth:") %> <%: Html.EditorFor(m => m.DateOfBirth) %> <%: Html.ValidationMessageFor(m => m.DateOfBirth) %> </div> I'm using an editor template i found, to show only the date correctly : <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>"%> <%= Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty))%> I used LinqToSql designer to create my model from an sql database. In order to do some validation i made a partial class Person to extend the one created by the designer (under the same namespace) : [MetadataType(typeof(IPerson))] public partial class Person : IPerson { //To create buddy class } public interface IPerson { [Required(ErrorMessage="Please enter a name")] string Name { get; set; } [Required(ErrorMessage="Please enter a surname")] string Surname { get; set; } [Birthday] DateTime? DateOfBirth { get; set; } [Email(ErrorMessage="Please enter a valid email")] string Email { get; set; } } I want to make sure that a correct date is entered. So i created a custom DataAnnotation attribute in order to validate the date : public class BirthdayAttribute : ValidationAttribute { private const string _errorMessage = "Please enter a valid date"; public BirthdayAttribute() : base(_errorMessage) { } public override bool IsValid(object value) { if (value == null) { return true; } DateTime temp; bool result = DateTime.TryParse(value.ToString(), out temp); return result; } } Well, my problem is this. Once i enter an incorrect date in the DateOfBirth field then no custom message is displayed even if use the attribute like [Birthday(ErrorMessage=".....")]. The message displayed is the one returned from the db ie "The value '32/4/1967' is not valid for DateOfBirth.". I tried to enter some break points around the code, and found out that the "value" in attribute is always null when the date is incorrect, but always gets a value if the date is in correct format. The same ( value == null) is passed also in the code generated by the designer. This thing is driving me nuts. Please can anyone help me deal with this? Also if someone can tell me where exactly is the point of entry from the view to the database. Is it related to the model binder? because i wanted to check exactly what value is passed once i press the "submit" button. Thank you.

    Read the article

  • Going back to ASP.Net Webforms from ASP.Net MVC. Recommend patterns/architectures?

    - by jlnorsworthy
    To many of you this will sound like a ridiculous question, but I am asking because I have little to no experience with ASP.Net Webforms - I went straight to ASP.Net MVC. I am now working on a project where we are limited to .Net 2.0 and Visual Studio 2005. I liked the clean separation of concerns when working with ASP.Net MVC, and am looking for something to make webforms less unbearable. Are there any recommended patterns or practices for people who prefer asp.net MVC, but are stuck on .net 2.0 and visual studio 2005?

    Read the article

  • Is MVC now the only way to write PHP?

    - by JasonS
    Hey... its XMAS Eve and something is bugging me... yes, I have work on my mind even when I am on holiday. The vast amount of frameworks available for PHP now use MVC. Even ASP.net has its own MVC module. I can see the attraction of MVC, I really can and I use it frequently. The only downside that I can see is that you have to fire up the whole system to execute a page request. Depending on your task this can be a little wasteful. So the question. In a professional environment is this the only way to use PHP nowadays or are their other design methods which have alternative benefits?

    Read the article

  • How can I convince my company to move to MVC?

    - by guanome
    I currently write web apps using asp.net web forms and getting my company to move to another technology is like [insert funny line here]. I would really like to start writing apps using MVC, but they fear any type of change. How is the best way to convince/ease them into using MVC? I guess this can go for moving to any new technology. Update Decided to go the rogue developer route and just started using it. I recreated a small app in MVC and learned the ropes that way, and moved up from there.

    Read the article

  • Is MVC now the only way to write PHP?

    - by JasonS
    Hey... its XMAS Eve and something is bugging me... yes, I have work on my mind even when I am on holiday. The vast amount of frameworks available for PHP now use MVC. Even ASP.net has its own MVC module. I can see the attraction of MVC, I really can and I use it frequently. The only downside that I can see is that you have to fire up the whole system to execute a page request. Depending on your task this can be a little wasteful. So the question. In a professional environment is this the only way to use PHP nowadays or are their other design methods which have alternative benefits?

    Read the article

  • Is this the correct way to implement .NET MVC website structure?

    - by aspdotnetuser
    I have recently seen a .NET MVC solution in which the markup in the .aspx views have a Controller as their model, and the .ascx user controls they contain use a separate model. I'm new to MVC and I wanted to find out about a few things I'm not clear on. An example of how the code is implemented: UserDetails.aspx view has markup that shows it's using the UserDetailsController.cs as the model. It contains RenderPartial("User_Details.ascx", UserDetailsModel) and passes it the UserDetailsModel. Is this the standard/correct way of implementing MVC? Or just one way to implement it? I also noticed that the classes used as Models appear to be Service classes that have [DataMember] and [DataContract] attributes on the class name and properties - what is the advantage of this implementation?

    Read the article

  • TryUpdateModel is not working for new Record on ASP.NET MVC Page?

    - by Rita
    Hi I have a customer Registartion page using ASP.NET MVC with fields like FirstName, LastName, Address from AddressDetail Table. When i create a new object for CustomerMaster and trying to update the fields using TryUpdateModel, it is not updating. But the TryUpdateModel is working fine on the Edit Profile Page and that particular record is referenced. CODE on Registartion Page: AddressDetail add = new AddressDetail(); bool status = TryUpdateModel<AddressDetail>(add, "addr", new[] { "FirstName", "LastName", "Address_1", "Address_2", "ZipCode", "City", "Phone", "Fax" }, formData); CODE on Edit Profile Page: AddressDetail addr = (from a in miEntity.AddressDetail where a.AD_Id == 20 select a).First(); bool rc = TryUpdateModel<AddressDetail>(addr, "addr", new[] { "FirstName", "LastName", "Address_1", "Address_2", "ZipCode", "City", "Phone", "Fax" }, formData); Does anybody run into same issue with TryUpdateModel? Doesn't it update the Model for New Record? Thanks

    Read the article

  • Best way of implementing DropDownList in ASP.NET MVC 2?

    - by Kelsey
    I am trying to understand the best way of implementing a DropDownList in ASP.NET MVC 2 using the DropDownListFor helper. This is a multi-part question. First, what is the best way to pass the list data to the view? Pass the list in your model with a SelectList property that contains the data Pass the list in via ViewData How do I get a blank value in the DropDownList? Should I build it into the SelectList when I am creating it or is there some other means to tell the helper to auto create an empty value? Lastly, if for some reason there is a server side error and I need to redisplay the screen with the DropDownList, do I need to fetch the list values again to pass into the view model? This data is not maintained between posts (at least not when I pass it via my view model) so I was going to just fetch it again (it's cached). Am I going about this correctly?

    Read the article

  • How to mask tilde (~) character in C# MVC routing table?

    - by AC
    I'm moving my home-baked web site to MVC and got the trouble with url routing. The site already serves several links that contain tilde (~) character in the path; something like http://.../~files/... http://.../~ws/... and I want each of them are handled by separate controller, like filesController, wsController, so my route table looks like routes.MapRoute( "files", "~files/{*prms}", new { controller = "files", action = "index", prms = "" } ); routes.MapRoute( "ws", "~ws/{*prms}", new { controller = "ws", action = "index", prms = "" } ); ... but when I try to get the result I got the error saying "The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character." As I understand those characters have the special meaning in ASP.net but is it possible to mask them somehow, at least tilde? Should I parse and route requests like this myself? What the best practice to handle urls like this? Thanks!

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >