Search Results

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

Page 52/2282 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Top 10 posts of 2010

    - by nmarun
    I quote one of my professors when I say: “We Share – We Improve”. It is through blogging that I’ve learned quite a bit. The ‘R&D’ done to learn and perfect a technology and the comments by other experts adds towards skill-set building. Below are some of the articles that I’m glad I blogged about. ASP.NET MVC 2 Model Binding for a Collection MVC 3 - first look To ref or not to ref Xap Reflector – Silverlight 4 Beware of const members LINQ to JS COM Automation with OpenOffice – Silverlight 4 VS 2010 Productivity Power Tools Using Unity Application Block – from basics to generics ASP.NET MVC Model Binding Wishing you all a happy 2011 and keep/start blogging!

    Read the article

  • ASP.NET MVC 3: RouteExistingFiles = true seems to have no effect

    - by Oleksandr Kaplun
    I'm trying to understand how RouteExistingFiles works. So I've created a new MVC 3 internet project (MVC 4 behaves the same way) and put a HTMLPage.html file to the Content folder of my project. Now I went to the Global.Asax file and edited the RegisterRoutes function so it looks like this: public static void RegisterRoutes(RouteCollection routes) { routes.RouteExistingFiles = true; //Look for routes before looking if a static file exists routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new {controller = "Home", action = "Index", id = UrlParameter.Optional} // Parameter defaults ); } Now it should give me an error when I'm requesting a localhost:XXXX/Content/HTMLPage.html since there's no "Content" controller and the request definitely hits the default pattern. But instead I'm seeing my HTMLPage. What am I doing wrong here? Update: I think I'll have to give up. Even if I'm adding a route like this one: routes.MapRoute("", "Content/{*anything}", new {controller = "Home", action = "Index"}); it still shows me the content of the HTMLPage. When I request a url like ~/Content/HTMLPage I'm getting the Index page as expected, but when I add a file extenstion like .html or .txt the content is shown (or a 404 error if the file does not exist). If anyone can check this in VS2012 please let me know what result you're getting. Thank you.

    Read the article

  • Applying business logic to form elements in ASP.NET MVC

    - by Brettski
    I am looking for best practices in applying business logic to form elements in an ASP.NET MVC application. I assume the concepts would apply to most MVC patterns. The goal is to have all the business logic stem from the same place. I have a basic form with four elements: Textbox: for entering data Checkbox: for staff approval Checkbox: for client approval Button: for submitting form The textbox and two check boxes are fields in a database accessed using LINQ to SQL. What I want to do is put logic around the check boxes on who can check them and when. True table (little silly but it's an example): when checked || may check Staff || may check Client Staff | Client || Staff | Client || Staff | Client 0 0 || 1 0 0 1 0 1 || 0 0 0 1 1 0 || 1 0 0 1 1 1 || 0 0 0 1 There are to security roles, staff and client; a person's role determines who they are, the roles are maintained in the database alone with current state of the check boxes. So I can simply store the users roll in the view class and enable and disable check boxes based on their role, but this doesn't seem proper. That is putting logic in UI to control of which actions can be taken. How do I get most of this control down into the model? I mean I need to control which check boxes are enabled and then check the results in the model when the form is posted, so it seems the best place for it to originate. I am looking for a good approach to constructing this, something to follow as I build the application. If you know of some great references which explain these best practices that is really appreciated too.

    Read the article

  • ASP.NET MVC 2: Mechanics behind an Order / Order Line in a edit form

    - by Dr. Zim
    In this question I am looking for links/code to handle an IList<OrderLine> in an MVC 2 edit form. Specifically I am interested in sending a complete order to the client, then posting the edited order back to an object (to persist) using: Html.EditorFor(m = m.orderlines[i]) (where orderlines is an enumerable object) Editing an Order that has multiple order lines (two tables, Order and OrderLine, one to many) is apparently difficult. Is there any links/examples/patterns out there to advise how to create this form that edits an entity and related entities in a single form (in C# MVC 2)? The IList is really throwing me for a loop. Should I have it there (while still having one form to edit one order)? How could you use the server side factory to create a blank OrderLine in the form while not posting the entire form back to the server? I am hoping we don't treat the individual order lines with individual save buttons, deletes, etc. (for example, they may open an order, delete all the lines, then click cancel, which shouldn't have altered the order itself in either the repository nor the database. Example classes: public class ViewModel { public Order order {get;set;} // Only one order } public class Order { public int ID {get;set;} // Order Identity public string name {get;set;} public IList<OrderLine> orderlines {get;set;} // Order has multiple lines } public class OrderLine { public int orderID {get;set;} // references Order ID above public int orderLineID {get;set;} // Order Line identity (need?) public Product refProduct {get;set;} // Product value object public int quantity {get;set;} // How many we want public double price {get;set;} // Current sale price }

    Read the article

  • Persisting complex data between postbacks in ASP.NET MVC

    - by Robert Wagner
    I'm developing an ASP.NET MVC 2 application that connects to some services to do data retrieval and update. The services require that I provide the original entity along with the updated entity when updating data. This is so it can do change tracking and optimistic concurrency. The services cannot be changed. My problem is that I need to somehow store the original entity between postbacks. In WebForms, I would have used ViewState, but from what I have read, that is out for MVC. The original values do not have to be tamper proof as the services treat them as untrusted. The entities would be (max) 1k and it is an intranet app. The options I have come up are: Session - Ruled out - Store the entity in the Session, but I don't like this idea as there are no plans to share session between URL - Ruled out - Data is too big HiddenField - Store the serialized entity in a hidden field, perhaps with encryption/encoding HiddenVersion - The entities have a (SQL) version field on them, which I could put into a hidden field. Then on a save I get "original" entity from the services and compare the versions, doing my own optimistic concurrency. Cookies - Like 3 or 4, but using a cookie instead of a hidden field I'm leaning towards option 4, although 3 would be simpler. Are these valid options or am I going down the wrong track? Is there a better way of doing this?

    Read the article

  • ASP.NET MVC solution to a forms application?

    - by Gloria Huang
    Hello, We're building a survey system and utilising ASP.NET MVC and wondered if anyone can offer suggestions on the architecture. Here's the problem we're trying to solve. Essentially an agency sends out several surveys every year. They're very structured and not like SurveyMonkey style of surveys - they're actually applications of feedback. Much like a Visa Application there are lots of things they need to do and sometimes it takes them 2-3 weeks to fill it out. They can upload files (proofs of purchase etc - PDF/JPG) and also multiple "items". Eg. Say for instance they've worked for McDonalds, there could be 20 different franchises, they build a list of locations they've worked. 3 weeks later there could be another 3 new locations and 2 may have closed down. So we need to ensure the forms are able to handle those situations. The forms themselves (markup and data) change every year - I should mention that this for a taxation/finance/budget system. We were thinking of using MVC, using Xml to store the data (temporarily), XSD to validate the data, XSL to transform the data to presentable markup (for them to fill out) and then once they "Submit" an application it gets stored into the DB in relevant areas. When the user starts the application process, they can save the progress so far (we validate whatever they entred and ignore any they havent), save it as an Xml blob and store in the DB. When they're finally ready to submit it, then we do a full validation and upload the files and store them securely (it has their business proofs and accounting statements) and then run some workflows. What I'm really concerned about is how to manage changing forms versions (a year later). How are form/application systems written these days? We have 2 months to pull this off and about 30 forms to deliver. So 30xXML, 30xXSD, 30xXSL.

    Read the article

  • Sorting, Filtering and Paging in ASP.NET MVC

    - by ali62b
    What is the best approach to implement these features and which part of project would involved? I see some example of JavaScript grids, but I'm talking about a general approach which best fits the MVC architecture. I've considered configuring routes and models to implement these features but I don't have a clear idea that if this is the right approach to implementing such features. On the one hand, I think if we put logic in routes (item/page/sort/), we would have benefits like bookmarking and avoiding JavaScript. On the other hand if we use JavaScript grids, we can have behavior like the old school grid views in ASP.NET web forms. I find that using HTML helpers may be useful for paging, but have no idea if they are good for sorting or not. I've looked at jQuery, tableSorter and quick search plug-ins, but they work just on the currently-fetched data and won't help in real sorting and filtering that may need to touch the database. I have some thoughts on using these tools side by side with AJAX to get something which works, but I have no idea if there are similar efforts done yet anywhere. Another approach I looked at was using Dynamic Data on web forms, but I didn't find any suggestions out there as to whether or not it is a good idea to integrate MVC and DD. I know implementing filtering and sorting for an individual case is simple (although it has some issues like using Dynamic LINQ, which is not yet a standard approach), but creating a sorting or filtering tool which works in all cases is the idea I'm looking for. (Maybe this is because I want have something in hand when web form developers are wondering why I'm writing same code each time I want to implement a sort scenario for different Entities).

    Read the article

  • Updated MVC 4 to 5.2.0 via Nuget Site compiles but wont run

    - by hjavaher
    I had the bright idea of updating my perfectly working ASP.Net MVC 4 application to the MVC 5 via nuget, Everything compiles just fine but when I try to run the application I get the following yellow screen of death. Has anyone gotten this or know how to solve it? I've searched for it and couldn't find any solutions. Please let me know if there is any farther information that would help you that I can give you. Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.MethodAccessException: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [MethodAccessException: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.] WebMatrix.WebData.PreApplicationStartCode.Start() +112 [InvalidOperationException: The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed..] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +556 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102 System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516 [HttpException (0x80004005): The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed..] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9885060 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

    Read the article

  • ASP.MVC 2 RTM + ModelState Error at Id property

    - by Zote
    I have this classes: public class GroupMetadata { [HiddenInput(DisplayValue = false)] public int Id { get; set; } [Required] public string Name { get; set; } } [MetadataType(typeof(GrupoMetadata))] public partial class Group { public virtual int Id { get; set; } public virtual string Name { get; set; } } And this action: [HttpPost] public ActionResult Edit(Group group) { if (ModelState.IsValid) { // Logic to save return RedirectToAction("Index"); } return View(group); } That's my view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Group>" %> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% using (Html.BeginForm()) {%> <fieldset> <%= Html.EditorForModel() %> <p> <input type="submit" value="Save" /> </p> </fieldset> <% } %> <div> <%=Html.ActionLink("Back", "Index") %> </div> </asp:Content> But ModelState is always invalid! As I can see, for MVC validation 0 is invalid, but for me is valid. How can I fix it since, I didn't put any kind of validation in Id property? UPDATE: I don't know how or why, but renaming Id, in my case to PK, solves this problem. Do you know if this an issue in my logic/configuration or is an bug or expected behavior? Thank you

    Read the article

  • How to best integrate HTML/design with C# code in ASP.Net or ASP.Net MVC?

    - by LuftMensch
    We're working on a new ASP.Net site. The last major site we did was in classic ASP--the procedure we used there was to have the HTML completed first, then "bring it to life" with the ASP code. In the ASP.Net world, how does this work? I.e. how do the designers do their work if much of the mark-up is actually being generated by the server controls? We are also looking at ASP.Net MVC as a potential lightweight alternative. Would be very interested to know what was worked best for people in both scenarios in terms of working with the designers and integrating their work with the code.

    Read the article

  • Modify post data with a custom MVC extension?

    - by Jaxidian
    So I'm looking into writing some custom MVC extensions and the first one I'm attempting to tackle is a FormattedTextBox to handle things such as currency, dates, and times. I have the rendering of it working perfectly, formatting it, working with strong types and everything all golden. However, the problem I'm now running into is cleaning up the formatted stuff when the page posts the data back. Take for example, a currency format. Let's use USD for these examples. When an object has a property as a decimal, the value would be 79.95. Your edit view would be something like: <%= Html.FormattedTextBox(model => Model.Person.HourlyWage, "{0:C}") %> This is all well and good for the GET request, but upon POST, the value is going to be $79.95, which when you assign to that decimal, gets unhappy very quickly and ends up shoving a 0 in there. So my question is, how do I get code working somewhere to work with that value before the MVC Framework goes and starts shoving it back into my ViewModel? I'd much rather this be done server-side than client-side. Thanks!!

    Read the article

  • asp.net mvc Ajax.BeginForm clone.

    - by denis_n
    Hello, I'm using asp.net mvc ajax. The partial view is using Ajax.BeginForm (just an example): <div id="divPlaceholder"> <% using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "divPlaceholder" })) { %> ... asp.net mvc controls and validation messages <input type="submit" value="Save" /> <% } %> </div> After update, if validation fails, the html is: <div id="divPlaceholder"> <div id="divPlaceholder"> ...form </div> </div> I don't like that the returned html is inserted, instead it should replace original div. Probably on POST I should not render <div> around form in partial view or render the div without id. What else can I do in this situation? I was thinking that maybe I should write a helper, something like Ajax.DivBeginForm, which will render form inside div on GET and hide the div on POST. Can somebody provide a good advice how to write such helper (Ajax.DivBeginForm)? I'd like it to work with using keyword: <% using (Ajax.DivBeginForm(new AjaxOptions { UpdateTargetId = "myId" })) { ... }%>

    Read the article

  • rendering front-end of survey into an MVC app

    - by HotKey
    Lately I have been watching Pluralsight intro videos on MVC 3. I have never worked with the Model View Control approach before, but I'm starting to understand how these 3 crucial parts of an app are separated. I created a front-end prototype of a survey I would like to implement into a View of my MVC web app. The survey is in HTML, CSS, using jQuery to deliver content changes depending on the type of evaluation (6-11 questions), and jQuery UI for a couple slider ratings. I noticed through tutorials that you can use an HTML form and helpers that allow the user to edit content, but my prototype already allows the users to rate via radio buttons, comment text boxes, and sliders. Would I need to change any of my existing code if I just want to store this employee data to the Model, and depending on what survey's the employee has completed through the Controller, disable drop down fields? Also, would I store the current employee data on submit of survey through an HttpPost in the Controller to the Model? My apologies if my questions seem rather vague. Could someone point me in the right direction to a resource or documentation similar to my needs above? The Pluralsight videos are taking me in the wrong direction.

    Read the article

  • routing difficulty

    - by user281180
    Part of my application maps resources stored in a number of locations onto web URLs like this: http://servername/Issue.aspx/Details?issueID=1504/productId=2345 Is it possible to construct an MVC route that matches this so that I get the path in its entirety passed into my controller? Either as a single string or possibly as an params style array of strings. In my Global.aspx I have routes.MapRoute( "Issue", "Issue/{Details}", new { controller = "Issue", action = "Details" }, new { issueId = @"\d+", productId = @"\d+" } ); I have tried the code RouteValueDictionary parameters = new RouteValueDictionary { {"Controller", "Issue"},{ "action", "Details" }, { "issueId", Test.ID }, {"productId", Test.Project.ID} }; VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, parameters); var test = vpd.VirtualPath; test value is /Issue.aspx/Details?issueId=1504&productId=3625. How to generate URLs Using ASP.NET Routing and sends it to users and they should be able to open the page by clicking on the generated link. However, here the servername isn`t included. How can I have the servername with the the link as http://servername/Issue.aspx/Details?issueID=1504/productId=2345

    Read the article

  • ASP.NET MVC Dropdownlist retain the selected value in the browser after post

    - by MLabib
    I build a drop down list in my aspx page as following <%= Html.DropDownList("SelectedRole", new SelectList((IEnumerable)Model.roles, "RoleId", "RoleName", Model.SelectedRole), "")%> it works fine for first Get and the first default value is selected; then I select item from the drop down list and submit the form. the controller bind the values correctly, public ActionResult About([Bind] Roles r) { //r.SelectedRole = the selected value in the page. //Roles r = new Roles(); r.roles = new List<Role>(); r.roles.Add(new Role(1, "one")); r.roles.Add(new Role(2, "two")); r.roles.Add(new Role(3, "three")); r.roles.Add(new Role(4, "four")); r.SelectedRole = null; return View(r) } Then I nullify the selected item and return my view, but still the previous selected Item is selected (although I did nullify it) Any Idea if I am doing something wrong or it is a bug in MVC? I am using ASP.NET MVC 1 Thanks

    Read the article

  • MVC design for archived data view

    - by Hemant Tank
    Implementation of a standard archive process in ASP.Net MVC. Backend SQL Server 2005 We've an existing web app built in MVC. We've an Entity "Claim" and it has some child entities like ClaimDetails, Files, etc... A pretty standard setup in DB. Each entity has its own table and are linked via FK. Now, we need to have an "Archive" feature in web app which will allow admin to archive a Claim and its child entities. An archived Claim shud become readonly when visited again. Here're some points on which I need your valued opinion - To keep it simple and scalable (for a few million records) for now we plan to simply add a bit field "Archived" to the Claim table in db. And change the behavior accordingly in the web app. We've a 'Manage claim' page which renders a bunch of diff views for Claim and its child entities. Now, for a readonly view we can either use the same views or have a separate set of views. What do you suggest? At controller level, we can identify archived claim and select which view to render. At model level, though it'd be great to be able to use the same model used for Manage Claim - but it might not get us the "text" of some lookup fields. For example, Claim.BrandId is rendered as a dropdown in Manage claim (requires only BrandId) but for readonly view we need 'BrandText'. Any existing ref or architecture level example would be great. Here's my prev SO post but its more about db level changes: Design a process to archive data (SQL Server 2005) Thank you.

    Read the article

  • Cloud hosted CI for .NET projects

    - by Scott Dorman
    Originally posted on: http://geekswithblogs.net/sdorman/archive/2014/06/02/cloud-hosted-ci-for-.net-projects.aspxContinuous integration (CI) is important. If you don’t have it set up…you should. There are a lot of different options available for hosting your own CI server, but they all require you to maintain your own infrastructure. If you’re a business, that generally isn’t a problem. However, if you have some open source projects hosted, for example on GitHub, there haven’t really been any options. That has changed with the latest release of AppVeyor, which bills itself as “Continuous integration for busy developers.” What’s different about AppVeyor is that it’s a hosted solution. Why is that important? By being a hosted solution, it means that I don’t have to maintain my own infrastructure for a build server. How does that help if you’re hosting an open source project? AppVeyor has a really competitive pricing plan. For an unlimited amount of public repositories, it’s free. That gives you a cloud hosted CI system for all of your GitHub projects for the cost of some time to set them up, which actually isn’t hard to do at all. I have several open source projects (hosted at https://github.com/scottdorman), so I signed up using my GitHub credentials. AppVeyor fully supported my two-factor authentication with GitHub, so I never once had to enter my password for GitHub into AppVeyor. Once it was done, I authorized GitHub and it instantly found all of the repositories I have (both the ones I created and the ones I cloned from elsewhere). You can even add “build badges” to your markdown files in GitHub, so anyone who visits your project can see the status of the lasted build. Out of the box, you can simply select a repository, add the build project, click New Build and wait for the build to complete. You now have a complete CI server running for your project. The best part of this, besides the fact that it “just worked” with almost zero configuration is that you can configure it through a web-based interface which is very streamlined, clean and easy to use or you can use a appveyor.yml file. This means that you can define your CI build process (including any scripts that might need to be run, etc.) in a standard file format (the YAML format) and store it in your repository. The benefits to that are huge. The file becomes a versioned artifact in your source control system, so it can be branched, merged, and is completely transparent to anyone working on the project. By the way, AppVeyor isn’t limited to just GitHub. It currently supports GitHub, BitBucket, Visual Studio Online, and Kiln. I did have a few issues getting one of my projects to build, but the same day I posted the problem to the support forum a fix was deployed, and I had a functioning CI build about 5 minutes after that. Since then, I’ve provided some additional feature requests and had a few other questions, all of which have seen responses within a 24-hour period. I have to say that it’s easily been one of the best customer support experiences I’ve seen in a long time. AppVeyor is still young, so it doesn’t yet have full feature parity with some of the older (more established) CI systems available,  but it’s getting better all the time and I have no doubt that it will quickly catch up to those other CI systems and then pass them. The bottom line, if you’re looking for a good cloud-hosted CI system for your .NET-based projects, look at AppVeyor.

    Read the article

  • Trying to build a Drupal-like CMS in ASP.NET MVC - Newbie Questions

    - by user252160
    I am new to ASP.NET MVC, and the ASP.NET technology in general, so, please, excuse the stupidity of my questions. I have a lot of experience with php development and CMS customization (Drupal and Wordpress mainly), and I wanted to know whether some techniques could be applied in asp.net mvc. I want to know what exactly could be modified without recompiling an already built application Can I edit the views without recompiling the app. Can I create custom themes ? Can I add plugins compiled as dlls and use them at runtime. Can I "mark" the assembly in such a way that the web application will check on the next request and will reference it, without me manually adding it to the project and recompiling. I've heard that this is possible. I will make sure to add more when something comes up. The reason I am asking is because I'd like to try and develop a Drupal-like CMS (custom types, views, etc) in asp.net mvc. The dynamism of php will be quite a challenge to replicate in a compiled technology, yet I am ready to try.

    Read the article

  • Render label for a field inside ASP.NET MVC 2 editor templates

    - by artvolk
    I'm starting to use DataAnnotations in ASP.NET MVC and strongly typed template helpers. Now I have this in my views (Snippet is my custom type, Created is DateTime): <tr> <td><%= Html.LabelFor(f => Model.Snippet.Created) %>:</td> <td><%= Html.EditorFor(f => Model.Snippet.Created)%></td> </tr> The editor template for DateTime is like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime>" %> <%=Html.TextBox("", Model.ToString("g"))%> But now I want to put inside editor template the whole <tr>, so I'd like to have just this in my view: <%= Html.EditorFor(f => Model.Snippet.Created)%> And something like this in editor template, but I don't know how to render for for label attribute, it should be Snippet_Created for my example, the same as id\name for textbox, so pseudo code: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime>" %> <tr> <td><label for="<What to place here???>"><%=ViewData.ModelMetadata.DisplayName %></label></td> <td><%=Html.TextBox("", Model.ToString("g"))%></td> </tr> The Html.TextBox() have the first parameter empty and id\name for textbox is generated corectly. Thanks in advance!

    Read the article

  • Write binary data as a response in an ASP.NET MVC web control

    - by Lou Franco
    I am trying to get a control that I wrote for ASP.NET to work in an ASP.NET MVC environment. Normally, the control does the normal thing, and that works fine Sometimes it needs to respond by clearing the response, writing an image to the response stream and changing the content type. When you do this, you get an exception "OutputStream is not available when a custom TextWriter is used". If I were a page or controller, I see how I can create custom responses with binary data, but I can't see how to do this from inside a control's render functions. To simplify it -- imagine I want to make a web control that renders to: <img src="pageThatControlIsOn?controlImage"> And I know how to look at incoming requests and recognize query strings that should be routed to the control. Now the control is supposed to respond with a generated image (content-type: image/png -- and the encoded image). In ASP.NET, we: Response.Clear(); Response.OutputStream.Write(thePngData); // this throws in MVC // set the content type, etc Response.End(); How am I supposed to do that in an ASP.NET MVC control?

    Read the article

  • Registering custom webcontrol inside mvc view?

    - by kastermester
    I am in the middle of a project where I am migrating some code for a website from WebForms to MVC - unfortunatly there's not enough time to do it all at once, so I will have to do some... not so pretty solutions. I am though facing a problems with a custom control I have written that inherits from the standard GridView control namespace Controls { public class MyGridView : GridView { ... } } I have added to the web.config file as usual: <configuration> ... <system.web> ... <pages> ... <controls> ... <add tagPrefix="Xui" namespace="Controls"/> </controls> </pages> </system.web> </configuration> Then on the MVC View: <Xui:MyGridView ID="GridView1" runat="server" ...>...</Xui:MyGgridView> However I am getting a parser error stating that the control cannot be found. I am suspecting this has to do with the mix up of MVC and WebForms, however I am/was under the impression that such mixup should be possible, is there any kind of tweak for this? I realise this solution is far from ideal, however there's no time to "do the right thing". Thanks

    Read the article

  • MVC nhibernate entiry mapping for dropdown list

    - by Rod McLeay
    Hi, I have a dropdown list on an ASP.NET MVC project that I am pretty sure is not binding to my model because of my nhibernate mapping. I have tried many variations on the asp mvc side resulting in this post here. MVC side of things seems fine I believe the issue may be that my object is trying to bind, but my mapping is out of whack. My mapping is: <many-to-one name="Project" lazy="false" class="AgileThought.ERP.Domain.Property.Project" column="ProjectGUID" /> My View gives an error saying that the GUID from the dropdownList selected value is not valid. Which I think may be that it is trying to push the GUID into my related project object. The value 'fd38c877-706f-431d-b624-1269184eeeb5' is invalid. My related project list binds to the dropdown list just fine, it is just not binding to my models Project entity. Does the related Project entity need to know about its relationship? Its really just a lookup list. Many thanks for your time and best regards, Rod

    Read the article

  • Creating an API for an ASP.NET MVC site with rate-limiting and caching

    - by Maxim Z.
    Recently, I've been very interested in APIs, specifically in how to create them. For the purpose of this question, let's say that I have created an ASP.NET MVC site that has some data on it; I want to create an API for this site. I have multiple questions about this: What type of API should I create? I know that REST and oData APIs are very popular. What are the pros and cons of each, and how do I implement them? From what I understand so far, REST APIs with ASP.NET MVC would just be actions that return JSON instead of Views, and oData APIs are documented here. How do I handle writing? Reading from both API types is quite simple. However, writing is more complex. With the REST approach, I understand that I can use HTTP POST, but how do I implement authentication? Also, with oData, how does writing work in the first place? How do I implement basic rate-limiting and caching? From my past experience with APIs, these are very important things, so that the API server isn't overloaded. What's the best way to set these two things up? Can I get some sample code? Any code that relates to C# and ASP.NET MVC would be appreciated. Thanks in advance! While this is a broad question, I think it's not too broad... :) There are some similar questions to this one that are about APIs, but I haven't found any that directly address the questions I outlined here.

    Read the article

  • get mail, Fire Job, Asp.Net, C#.Net

    - by AjmeraInfo
    I live in India and My hosting server at US. I am using MSSQL, ASP.Net and C#.Net I want to fire job when i will get email. ex. someone send mail on my address. then i want to get sms for email description. it not possible to install any desktop or console application on US hosting server. I don't have that type of rights.

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >