Search Results

Search found 57033 results on 2282 pages for 'asp net mvc 2 metadata'.

Page 71/2282 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • Getting error in MVC Proj while writing Lambda Expression

    - by Shrewd Demon
    hi, i am creating a sample movie (MVC) application. I was getting fine with Viewing and Creating a new record, but when i wrote the code to get the details of a particular record i met with the following error: Unable to cast objec`t of type 'System.Data.Objects.ObjectQuery`1[MovieApp.Models.Movie]' to type 'MovieApp.Model`s.Movie'. here is the code i wrote for getting the details public ActionResult Details(int id) { var moviedetail = (Movie)_entities.MovieSet.Where(mvid => mvid.Id == id); return View(moviedetail); } can any body tell me whats going wrong and where ?? thank you.

    Read the article

  • ASP.NET MVC: Posting JSON to Controller

    - by JamesBrownIsDead
    I've got this in my controller: [HttpPost] public void UpdateLanguagePreference(string languageTag) { if (string.IsNullOrEmpty(languageTag)) { throw new ArgumentNullException("languageTag"); } ... } And have this jQuery code POSTing to the controller: jQuery.ajax({ type: 'POST', url: '/Config/UpdateLanguagePreference', contentType: 'application/json; charset=utf-8', data: '{ "languageTag": "' + selectedLanguage + '" }' }); When I try to the code, however, I get the error: Server Error in '/' Application. Value cannot be null. Parameter name: languageTag What's the problem? Isn't this how to POST JSON to an MVC Controller? I can examine the POST using Fiddler and see that the request is correct. For some reason, UpdateLanguagePreference() is getting a null or empty string.

    Read the article

  • ValidateInput Attribute Doesn't Seem To Work in ASP.NET MVC

    - by JC Grubbs
    I'm trying to get around the "potentially dangerous Request.Form value" error and I'm having no luck. Yes, yes, I've read all the other StackOverflow related questions and none of them seem to get me closer to an answer. I am using [ValidateInput(false)] on all related controller actions...and I've checked many times. I'm using ValidateRequest='false' in all the related ASPX views. I am using ASP.NET MVC 2 Preview 1, but I don't think that's an issue since the error is being generated lower in the framework; Page.ProcessRequest to be exact. I can't see anything I'm doing wrong, I even set <page validateRequest='false'> in the web.config and that didn't solve it either. HELP!!!!!

    Read the article

  • PayPal IPN & ASP.NET MVC

    - by Wayne
    Hello - I have a strange problem that somebody can hopefully help me with. For a while now I have been using PayPal's IPN service for our website. In order to test it I have a port opened up on our firewall pointing to my machine. This has been working great with no problems at all. I recently upgraded to the RTM release of ASP.NET MVC and now things are not working. I can navigate to my IPN handler from the outside world so I know it's not my connection or a firewall issue. It simply refuses to recieve any PayPal IPN messages. I am puzzled why the page can be accessed yet the PayPal IPN server wont connect to it. I realize there could be a 1000 different reasons for this, but I am hoping somebody out there can point me in the right direction!

    Read the article

  • Home Pages in ASP.NET MVC

    - by Maxim Z.
    I'm trying out ASP.NET MVC, but, after reading a huge tutorial, I'm slightly confused. I understand how Controllers have Actions that URLs are routed to, but how do home pages work? Is the home page its own controller (e.g. "Home") that has no actions? This sounds correct, but how is it functionality implemented without Actions (no Actions means no methods that call the View Engine)? In other words, my question is this: how are home pages implemented (in terms of Controllers and Views)? Could you please provide sample code?

    Read the article

  • Clone DB table row through MVC in MSSQL

    - by sslepian
    Is there a simple solution for duplicating table rows in MSSQL as well as all table rows with foreign keys pointing to the cloned table row? I've got a "master" table and a bunch of "child" tables which have a foreign key into the ID of the master table. I need to not only create a perfect copy of the master table, but clone each and every child table referencing the master table. Is there a simpler way to do this than creating a new row in the master table, copying in the information from the row to be cloned, then going through each child table and doing the same with each row pointing to the cloned row in the master table? I'm using a MSSQL 2005 Database accessed through C# ASP.net MVC 1.0.

    Read the article

  • view state in ASP.NET MVC Application

    - by Shetty
    Hi, I have read that viewstate is not there in asp.net MVC application. I am doing model validation. Now if i have two text boxes on my page,and i am doing required filed validation for both of them in model. This validation is done on server side on click of a button. I will fill one text box and click on submit button. It does the validation and returns the result saying second field is required. At this time value of the first text box is retained. So can you tell me how this text box is retaining the value even after postback?

    Read the article

  • Handling Exceptions that happen in a asp.net MVC Controller Constructor

    - by Jason
    What's the best way to handle exceptions that happen from within a controller's constructor? All I can think of to do is use Application_OnError() or put a try/catch in my ControllerFactory. Neither of these solutions seem ideal. Application_OnError is to broad - I have some non-mvc content in the site that has its own error handling. Using a try/catch block seems kinda hacky. If I'm serving different content type -html/text/json/rss.... I would like to be able to handle the exception from within the action method instead of having to write all kinds of conditions to determine what kind of error message to serve. Am I missing something here, or has anyone else dealt with this?

    Read the article

  • Need an Asp.net MVC Application solution

    - by Daoming Yang
    I have implemented a small ordering and stock control system (for internal using) with the MVC 2 framework. Now my friends, they want to have a website to present the existing products for their customers. I know, I know they will ask me to do this one day. So in the beginning, I have made the controller name to start with "Admin". But now I am not sure the best way to implement their requirements. Could you advise me? 1.For the security reason, I did not allowed anonymous user to access the website a part from the CSS and image files. My question is the controllers' name are not folders' name, how could I set this up? 2.I'm planning to put the admin section into an "area" and will it be a good way to go? Can anyone provide me some suggestions. Many thanks.

    Read the article

  • ASP.NET MVC Persisting mdoel's ID value when Editing

    - by user295017
    public Edit(int? id){ /* Codes */ } [HttpPost] public Edit(Item model){ /* Codes */ } I retrieve a copy of Item in the first Edit method, which would contain a value for ItemID. But when it gets to the HttpPost method, the id value's lost. If switched to public Edit(int? ItemID){ /* Codes */ } [HttpPost] public Edit(Item model){ /* Codes */ } this way ItemID can be persisted in the Item model. But is this a good way to handle it? Will ASP.NET MVC always be able to know that it needs to plug "ItemID" into Item? and are there other ways to persist the ID value? Thanks.

    Read the article

  • ASP MVC dynamic fields in editor

    - by Michael Pardo
    I have a form which will include some optional questions that need to asked of the user. In my model it may look like pubic Dictionary<String, String> Questions { get; set; } where the key is the label and value is the text box. How can I create and populate controls for this? I'm new to ASP MVC, but it makes sense that something like this would be built in. Is there a built in way to do this, or do I have to implement it myself? It seems like there should be a helper for it, since you don't really want to put this kind of code in the view. I've tried Html.EditorFor(model => model.Questions); but it just spits out "[key, value]" to the view.

    Read the article

  • MVC Html Layout C# code formatting

    - by Andrew Florko
    I insert into asp.net mvc views C# logic that manages layout like the following: <% if (Model.People.Count > 0 ) { %> <% foreach (var person in Model.People) { %> ... <% }} else { %> <span class="error">Sorry, no people</span> <%} %> I try to minimize <% % code placing "{" symbol on the same line as it's condition (java-style). Html layout looks more clear to me after that. Do you apply C# formatting rules to <% % html injections "}" should be on a new line or manage layout in different way? Thank you in advance!

    Read the article

  • Preventing cross-site scripting in ASP.NET MVC - using jQuery or standard HtmlHelpers

    - by user313353
    I am building an ASP.NET MVC application that is AJAX-driven. For some reason I need to add some DOM elements on the fly when clicking a submit button. This is accomplished with jQuery.append(). One element inserted is a textarea, whose the data must be parse before submitting to ensure that no cross-site scripting can be done. We know that the Html.Encode() works great but must be declared outside a script tag. All I have done with jQuery is embedded within a script tag. 1) Is there a way to take advantage of the Html.Encode() within a script tag? 2) How can I accomplish this with jQuery? At worst I can use HttpUtility.HtmlEncode(), which is called on the server-side. Thanks for your help. Roland

    Read the article

  • Business and data layer in ASP.NET MVC

    - by Shetty
    Hi, I am new to ASP.net MVC architecture. I have read in some articles that Model will contain business and data access logic. So does this mean that i have to implement the business and data access layrers in side model folder? And it is obviously not possible to add class libraries (business layer and Data access layer of n tier) in Model folder. SO please let me know how to design business and data layer if i dont want to include my LINQ queries in Controller. Thanks, Amith

    Read the article

  • Downloading files in ASP.Net MVC web applications

    - by kingrichard2005
    Hello, I'm working on a project that requires the ability to let a user download a pdf from a static location on the server. I'm reading the instructions from this website, it's an old post and I notice they specify in an update that Microsoft's MVC framework has long since included and Action Result that allows the same functionality they discuss thus rendering it obsolete, I've looked a bit online but haven't been able to find any resources that discuss this built-in functionality. If anyone has any links or other information that discuss this it would be very helpful. Thanks.

    Read the article

  • ASP.Net MVC - bulk / batch insert with through controller

    - by user610358
    guys, I need to make a view which will support bulk insert. In my mvc app, I am using repository patern with entity framework for. I am only having problem on how I will going to retrive the values of the model. There will be multiple model inpouts inside the view. I am sure that I am going to use foreach or for loop but how I am going to retrive the input values form view into controller. any help would be appreciated. thanks.

    Read the article

  • MVC Forms Authentication with custom database

    - by AndrewVos
    I'm trying to get forms authentication working for an mvc site. I have a custom database with a users table, and I would like to do my own password validation. I am logging in my user like this: if (PasswordHasher.Hash(password) == dataUser.Password) { FormsAuthentication.SetAuthCookie(email, true); return true; } The problem is, when the session expires obviously the user has to login again. I am thinking I should be storing this Auth cookie in my users table? Update: I'm obviously in desperate need of more education in this area. I just noticed that the user stays authenticated even after an iisreset. I guess what I'm asking is how can I get persistent and non persistent authentication working properly. I want a user to not have to login again if they click "remember", and if they don't then their authentication should expire when the forms authentication is set to expire.

    Read the article

  • asp.net mvc cookies not persisting on local server (aspnetserve)

    - by DW
    Hi. Trying to run an MVC app on the 'portable' web server. Software is aspnetserve. (http://www.ohloh.net/p/aspNETserve) Cookies do not persist. They do fine when I run from visual studio debug. Code is fine, seemingly. Only are dead (fail to persist from page to page) when I use this server. My solution requires deploying a portable local solution like this for the app. (this isn't just being done for purposes of testing) Rather stumped right now. Any bright ideas? Thank you.

    Read the article

  • ASP.NET MVC - Organizing Site / URLs

    - by CocoB
    My question is around the best practice for dividing up an asp.net mvc web app. I am building a fairly simple application which has two main sections, public and private. Basically I am running up against the issue of collisions between controllers. What I want is to have urls like /public/portfolio, but also have /private/portfolio. Looking into some options, it seems that areas would work well for this situation. Are there other alternatives, such as some creative routing scheme that I should consider?

    Read the article

  • How to handle ViewData type casting in MVC

    - by Wondering
    Hi All, I am new to MVC and facing one issue. I have a xml file and i am retrieving its value using Linq to xml and assigning it to ViewData. Controller.cs var res=from x in doc.Descendants("person") select new { Fname=x.Element("fname").Value, Lname=x.Element("lname").Value }; ViewData["Persons"]=res; in View I am trying <% foreach (var item in ViewData["Persons"]) { %> <li> <%= item.Fname %> </li> <% } %> but foreach (var item in ViewData["Persons"] is giving type casting error..what should be the exact type csting so that i can retrive values in the format item.Fname. Thanks.

    Read the article

  • Creating Html Helper Method - MVC Framework

    - by nettguy
    I am learning MVC from Stephen Walther tutorials on MSDN website. He suggests that we can create Html Helper method. Say Example using System; namespace MvcApplication1.Helpers { public class LabelHelper { public static string Label(string target, string text) { return String.Format("<label for='{0}'>{1}</label>", target, text); } } } My Question under which folder do i need to create these class? View folder or controller folder? or can i place it in App_Code folder?

    Read the article

  • Remove Validation in ASP.NET MVC 3

    - by johndoe
    I am trying to get remote validation working in ASP.NET MVC 3 but for some reason the validation never gets fired. I am returning json from the controller and in FireFox it ask me to download the files. Not sure what is going on here. Here is my code: @using(Html.BeginForm(new {Action = "ValidateUserName"})) { <text> Enter UserName: </text> @Html.TextBoxFor(x => x.UserName) <input type="submit" value="Login" /> } Here is the RegistrationViewModel: public class RegistrationViewModel { [Required(ErrorMessage = "UserName is required!")] [Remote("ValidateUserName","Home",ErrorMessage ="UserName already taken!")] public string UserName { get; set; } } And here is the HomeController: public ActionResult ValidateUserName(RegistrationViewModel registrationViewModel) { return Json(!registrationViewModel.UserName.Equals("test"),JsonRequestBehavior.AllowGet); }

    Read the article

  • MVC Helper Extension issue

    - by BeCool
    Hi, I need to implement a HtmlHelper extension in my MVC project simply just to output some string but ONLY in the DEBUG mode, not in REALEASE. My first attempt would be: [Conditional("DEBUG")] public static string TestStringForDebugOnly(this HtmlHelper helper, string testString) { return testString; } But obviously that would give a compile error: "The Conditional attribute is not valid because its return type is not void." So my understanding is once you set [Condition] attribute, it doesnt allow to return anything? why? What is other way to implement this kind of function? anyone help would be much appreciated. Thanks!

    Read the article

  • SFTP with .net 3.5?

    - by nrk
    I need to connect to sftp server to download & upload file using C# in .net 3.5. Is Microsoft/.net 3.5 framework providing any inbuilt tools/mechanism/library to connect to sftp server to download & upload files?

    Read the article

  • SFTP in C# with .net 3.5?

    - by nrk
    Hi, I need to connect to sftp server to download & upload file using C# in .net 3.5. Is Microsoft/.net 3.5 framework providing any inbuilt tools/mechanism/library to connect to sftp server to download & upload files? Thanks nrk

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >