Click here to Skip to main content
15,884,836 members
Everything / Controller

Controller

controller

Great Reads

by Fiyaz Hasan
Learn how dependency injection mechanism has evolved from ASP.NET to ASP.NET Core
by Ehsan yazdani rad
XAF is a good framework that facilitates software making, but as it provides many benefits, there is the limitation that you have to deal with, one of them is placing fully customized form in a view
by Mikhail-T
How to convert string to text file and return it back to user as a result of a controller action
by Pedram_Niloufari
C# .Gif viewer / Snipper control

Latest Articles

by ToughDev
More about ST7735 1.8-inch 128×160 Color LCD on a PIC Microcontroller
by Minh Danh Nguyen (ToughDev)
This is a cheap 320×240 2.8″ TFT LCD module that uses the ILI9320 controller for the display and the XPT2046.
by ToughDev
Experiment with ST7920 128×64 graphical LCD on PIC
by Aram Tchekrekjian
How to localize in ASP.NET Core Web API 6

All Articles

Sort by Score

Controller 

28 Dec 2016 by Fiyaz Hasan
Learn how dependency injection mechanism has evolved from ASP.NET to ASP.NET Core
7 May 2013 by Ehsan yazdani rad
XAF is a good framework that facilitates software making, but as it provides many benefits, there is the limitation that you have to deal with, one of them is placing fully customized form in a view
19 Jul 2013 by Mikhail-T
How to convert string to text file and return it back to user as a result of a controller action
27 Jun 2015 by Pedram_Niloufari
C# .Gif viewer / Snipper control
7 Feb 2022 by Aram Tchekrekjian
How to localize in ASP.NET Core Web API 6
26 Jul 2012 by codeBegin
How to call the javascript function from MVC controller method[^]MVC3 Razor: call javascript function from view[^]How to call javascript function from a controller in MVC3[^]ASP.NET MVC: How to call javascript function[^]
26 Jul 2012 by Zoltán Zörgő
First of all you can not call javascript from controller. Javascript runs on client side, your controller is running on the server.Although you can make the view execute code on behalf of the server.If speaking from validation in general, you can do client and server side validation in...
3 Oct 2012 by drstylo
public ActionResult Pending_CashDisbursement() { ViewData["listPA"] = GetPA(); ViewData["listPSA"] = GetPSA(); return View(); } public SelectList GetPA() { cmn_top objCmn_top = new cmn_top(); ...
17 Oct 2012 by Sergey Alexandrovich Kryukov
Something is fundamentally wrong with your approach to work in general. Was it so difficult to look at the MSDN help page and see the right spelling? Well, take a look now:http://msdn.microsoft.com/en-us/library/system.string.substring.aspx[^].Please, no offense: what you really need to...
17 Jan 2013 by fjdiewornncalwe
Close, but not quite how it works. Here is a sample of how it should look. $.ajax({ type: 'GET', url: '/YourController/YourMethod', dataType: 'json', async: false, data: { arg1: 'arg1value', arg2: 'arg2value' }, success:...
14 May 2014 by Member 10800628
i am migrating my Glider automation code from 2010 to 2012 but while i am running the code it gives me an error saying "Failed to connect to remote Controller on machine 'lpoauto10', port '6901': A connection attempt failed because the connected party did not properly respond after a period of...
6 May 2014 by Thomas Nielsen - getCore
Hi, you may need to poste more details to get good help here. I've found a lengthy step by step debugging article for you in the meantime :)...
24 Jul 2014 by Yogesh Kumar Tyagi
view this article it may help youhttp://www.c-sharpcorner.com/UploadFile/3d39b4/casecading-dropdown-list-with-mvc-linq-to-sql-and-ajax/[^]
23 Dec 2014 by WaterFountain
The code for my android application is below and so far I'm happy with it. Before anyone comments, I do acknowledge it requires the addition of further validation. The android application is a login system which makes use of SQLite to store login information such as usernames and passwords for...
23 Jul 2015 by Sergey Alexandrovich Kryukov
This is just a bug. You need to guarantee that the mutex always released, so you should not release it under the "try" block, you should not release it under "catch" block; you should only release it in the "finally" block.Are you saying that it all "works" properly without correctly...
16 Sep 2015 by F-ES Sitecore
That code isn't business logic, it is code that deals with the inputs from the view and handles what is output from the controller so it should stay in the controller. When people say you should have business logic they mean code that governs the rules of how your site works. So if your site...
25 Feb 2016 by CPallini
Bootloaders highly depend on the target microcontroller architecture. You have to:Search for manufacturer's documentation about (e.g. application notes).Look at forums specialized on the target microcontroller.
25 Feb 2016 by Jochen Arndt
There is usually no need to write your own boot loader. Just use the one that is provided by the manufacturer of your microcontroller (there is often an application note). If necessary, you can modify the code to match your needs. Because you are using your controller the first time and are...
12 May 2016 by Dave Kreskowiak
There's really nothing to help with. It comes down to you reading up on SQL Server security and understanding how it works and how to set it up. There is no way you're going to have someone just give you a blurb in a forum post and it'll magically work.The error is pretty clear. The SQL...
14 Nov 2016 by Dave Kreskowiak
Google for "MVC Controller async".
26 Jan 2017 by F-ES Sitecore
That's how dropdowns work, there are two elements, the name and the value. The name is what appears in the list and the value is what is submitted with the form. Normally you'd convert the ID back to the relevant text when needed. However if you really do only want the text and you don't care...
20 May 2020 by F-ES Sitecore
If this is per-user data then use the "Session" object. If the data is global then use the System.Web.Caching.Cache object Cache Class (System.Web.Caching) | Microsoft Docs[^]
9 Sep 2020 by Dave Kreskowiak
The WebApi cannot show any user interface at all. That's up the the application using the Api, not the Api itself.
23 Sep 2020 by F-ES Sitecore
Have a read of this Call a Web API From a .NET Client (C#) - ASP.NET 4.x | Microsoft Docs[^] if you google "use httpclient to call web api" you'll find lots of other examples to look at.
2 Apr 2021 by Member 15015917
Hi, I would like to order my data list by date descending based on my joined table of SQL database. I have this code; var dataTransfer2 = dataTransfer.Join(smlPortal.SML_QC_SokuteiRejectsTransaction, a => a.Id, b => b.SokuteiRejectId, (a,...
22 Nov 2018 by 204.sharma
Hi, I have created a pagedlist in mvc view. But now when i do pagination my model object properties lost on 2nd page and after pages. I am creating a report page on filter basis. So what is the best process to achieve this ? What I have tried: Here is my Model class public partial class...
29 Nov 2021 by Uladzislau Baryshchyk
This series of articles consists of three articles, in which I will demonstrate step by step how to create a .NET core MVC project
2 Jan 2012 by Hamed Metalgear
Hey guys, I have a Canvas inside a grid, the Height and Width of the canvas is set to be Auto.In my code behind, I need to draw a shape (i.e. Line, Rectangle) inside this Canvas and set the size of the shape to the size of Canvas (i.e. a Rectangle which has a Height same as the canvas and a...
17 Jan 2012 by SteveAdey
It depends on where you are trying to find out your canvas height.You could override the OnRenderSizeChanged in the containing view. At this point the canvas has been given a size and ActualHeight with then work correctly.
26 Jul 2012 by dilzz
HI, I have a doubt in Asp.net MVC3 application.i am creating a login page and login page contains a javascript function (index.chtml - View) and the javascript function contains the validation of controls and displaying the Errors.Here i need the code for calling javascript function...
3 Oct 2012 by venkat pavan
Tryhttp://weblogs.asp.net/raduenuca/archive/2011/03/06/asp-net-mvc-cascading-dropdown-lists-tutorial-part-1-defining-the-problem-and-the-context.aspx[^]
17 Jan 2013 by Member 8044586
This seems easy but is not just working for me. I have the following code to run a method in my HomeController from my javascript filefunction(id) alert("here"); $.ajax({ url: '/HomeController/MethodName, data: { id: id } success: function(data){ alert('Sucess ' + data); ...
8 Mar 2013 by dedo1991
Dear programming community,I am trying to populate the dropdown list by calling a method from the controller.The reason why i am doing this is because i want to pass it an id and therefore ill be getting a different list for each record.Viewgrid.Column(header: "Wards", format:...
8 Mar 2013 by venumailorg
You have to return the result in JSON format from controller. Then at the client side use JQuery to populate the values in the dropdown list using the JSON resultset.
12 Dec 2018 by Nuha IT
Hi,I have a textBox in the index page and I want it to take the value from this text to the google search engine in another page.how can i pass this variable from control to the cse?This is the index code for passing the variableResponse.Redirect("Search.aspx?parma=" +...
28 Mar 2013 by Prasad Khandekar
Hello,Please find below the code to do this. Element V2: Google-hosted Layout Demo (function() { var cx = '003646811200027851123:9ubv0q_x_z0'; var...
27 May 2013 by kranthi1988
HI All,Im working on MVC4,We are validating the fileds in MODEL class using data annotation 'ValidationAtrtribute'.Everything is working fine as functionally but while throwing messge to the user, popup meessage window having a Header like 'Message From Webpage' and first word of the...
31 May 2013 by Vitalij Dešuk
I have User, Prog, Enrollment model associated has_man through. Idea is that User adds Prog to profile and Prog can accept User's request or decline.
18 Jun 2013 by Makin6425
Hi, at the moment I have a OrderConfirmationController which has a Details view which displays the records. At the bottom of the Details View I want to add 5 fields from another table that will be displayed in the view but not sure how to add them.At the bottom of the last table I want to...
11 Oct 2013 by ASP.NET Community
MVC routingIn ASP.NET MVC 3 one of the main parts is routing. The routing is helps to map the particular view and particular controller.When we
23 Oct 2013 by Nkumary
I have a MVC 4 application with razor engine. I want to add a search function to my view which show a list of teachers. The view is strongly typed view.My Models is : Teacher.csnamespace TestGrid.Models{ public class Teachers { private String _TeacherName; ...
10 Nov 2013 by Christian Graus
Throw all this out and use Entity Framework instead. That makes it even easier to write code to search your database.
3 Dec 2013 by sid2586
i have a method in controller which should generate excel.my code in controller is as:public ActionResult ExportData(){string[] abc = { "AAA", "BBB", "CCC" }; GridView gv = new GridView(); gv.DataSource = abc; gv.DataBind(); ...
4 Dec 2013 by Maciej Los
Have you tried to use Google[^]?Sample links:MVC3 Export To Excel[^]Export to Excel in Asp.net MVC [closed][^]MVC: Exporting data to .XLS “Excel Files”[^]Next time, please be more specific. Before you ask a question, please try to debug an application.
30 Dec 2013 by Aaditya parcha
Hi,i have a student class like belowpublic class Student { public int stdId { set; get; } public string stdName { get; set; } public string dept { get; set; } }and my controller code is public ActionResult Student() { ...
2 Jan 2014 by rizwan muhammed khan gouri
hello i hope this works for you.. used instead thisList lstStd = new List() { new Student() { stdId = 103, stdName = "bharath", dept = "CSE" }, new Student() { stdId = 104, stdName = "Hari", dept = "IT" } };useList lstStd = new...
25 Jan 2014 by AlexHarmes
I am dynamically building pages with forms from my db, which means I can have 1 form or many per page.All of my forms have unique Ids and Submit buttons, however within each form the ids and names of the inputs are the same.
25 Jan 2014 by Dave Kreskowiak
AFAIK, there is no way to submit one form. If you submit any form from the browser, it will submit all of them. In MVC, you'll get a FormsCollection[^] passed to your action method. Normally, you would just pick out the form of interest to your code and ignore the rest in the collection.
28 Jan 2014 by AlexHarmes
Too close to the forest for the trees??? One silly mistake and it has taken me days to sort it; I never closed the form tag... I am not used to HTML helpers and it is obvious how dangerous a little bit of knowledge is.To submit a single form, close the tag; Html.EndForm();
28 Jan 2014 by AlexHarmes
I can't believe this - I hadn't used the Html.EndForm(); tag. By inserting this at the end of my View form block, I now have the form returning just the values for the one submitted!
6 Apr 2014 by kashyap10
I got the solution ...basically your mvc application may get block when you transfer your project over machines ..Here is a list of ways your file may get blocked: - Your Project is under CVS, SVN, Git or Mercurial Source Control, and you just fetched the latest version of the...
15 Apr 2014 by Suraj Sahoo | Coding Passion
Its quite simple as per your question what I get is you want to know how to get the respective method/controller of a particular view. Do one thing go to every action methods and right click and then go to view. You can do the reverse too go to View and right click and go to controller. And with...
29 Jul 2014 by AmolPatil19787
Hi,Need your help,We are using Ajax methods to call MVC controller methods.here is the sample code we have used,var rowID="100";$.ajax({ type: "POST", url: "/home/selectdatafromlist", data: "id=" + rowID, ...
24 Jul 2014 by brknlpr
hello everybody I am trying to get data when one of my dropdown selected index change here are my codes I couldn't get where am ı missing or doing something wrong I am very glad if you help me thank you .this is my script code$("#ddOrder").change(function (e) { alert =...
18 Aug 2014 by Matys88
Hello, i have one question. I have some controllers in my project and i try to created redirect this actions to one View. I want to create this option in special cases for example: I want, blocked application on 5 minutes in date 18/08/2014 at 21:00. In this time you can't nothing to do, when...
18 Aug 2014 by uspatel
First you need to create a Controller and view for error message likepublic class HomeController : BaseController{ public ActionResult Index() { ViewBag.Message = TempData["Message"]; return View(); } public ActionResult ErrorMessage() ...
12 Sep 2014 by palash.chakma
Hi,I was trying to filter data on html table based on the selection changed in drop down list. I was able to show data in page in a and also able to pass the drop down value. But not quite sure how to rebind that data.Could someone please help will be highly appreciated.Thanks,Palash
14 Sep 2014 by Mihir_Naik
Description: When i post form with two count of puchaseordertax, i will found that but if i post with only one record (Count) it did'nt![Note:Uid is working s index and Correctly! ]My Model:class PurchaseOrder{int PurchaseOrderID {get;set;}datetime PurchaseOrderDate {get;set;}public...
22 Jan 2015 by Peter Leow
Mot a question. This is no source code directory service portal. Try Google.
26 Jan 2015 by frostcox
Hey guys, I have a strange problem when I deploy my website to my production environment. During development when I post my form back to the controller the ModelState is valid but after deploying to the production enviornment in IIS the ModelState is always invalid after entering in the exact...
26 Jan 2015 by Abhinav S
This could be because you are connecting to a different database in Production and this could be returning wrong / unexpected values while running the code.
26 Jan 2015 by E.F. Nijboer
Sounds like the old "Works on my machine" problem. Check the database of both production and your development (test/acceptance?) machines. Look at validations that could easily break due to cultural differences like dates for example. Check machine language and culture settings and make sure...
26 Jan 2015 by frostcox
Hey Guys, I figured out a way to see what properties in the model state we actually invalid. Hope this helps somebody else.... ICollection _collection = ModelState.Values; foreach (ModelState _modelState in _collection) { ...
18 Feb 2015 by Jochen Arndt
You can't do that using a C program (or any other language and even assembler). Micro controllers have specific command sets. While controllers from one family may have identical or compatible command sets this is not true when the architecture is different. The architecture of 8, 16, and 32 bit...
18 Mar 2015 by Prasad Avunoori
Hi,I am returning the ReportViewer object from MVC Controller to aspx view.Controller: [HttpPost] public ActionResult PortedDataReport(PortedDataReport portedDataReport) { ReportViewer mainReportViewer = new ReportViewer(); ...
29 Mar 2015 by Navneet k soni
Here i have a Code for a html hyper link page to redirect on a specific new page Controller Page Code public ActionResult our-services() { ViewBag.Message = "Your contact page."; ...
12 Apr 2015 by Am Gayathri
How do i use two model in one view in MVC4? I want to use two different models in my form.One is for registration another for login. I want to use both models in my main view. I added one model that contains two other model for registration and login. but am unable to fetch the values in...
12 Apr 2015 by Abhinav S
This article discusses many approaches to do this - Multiple Models in a View in ASP.NET MVC 4 / MVC 5[^].Multiple Models in Single View in MVC[^] will also help you.
14 Apr 2015 by Am Gayathri
I have one view and that view contains create user and login forms. For both i have different models. When user clicks on Register button i will pass register model values and for login click i pass login model values.I have added some validation in model also (You can see it my code...
14 Apr 2015 by Yuriy Loginov
1. You could split this into two separate views each one using its respective model. So one view uses RegistrationModel only and the other view uses LoginModel model only2. On the login model you can set dummy values for fields of RegistrationModel@Html.HiddenFor(model =>...
1 Jun 2015 by Afzaal Ahmad Zeeshan
If you created the file yourself, you forgot to close the stream. If Visual Studio is using it, restart your system there are a lot of underground processes that might be using the files, and even in Task Manager you would have no idea which of the process is using it. (I have no idea of doing...
8 Jun 2015 by ADS14
Hi all,In a MVC model pattern what happens when no controller name is specified in the URL, for example..www.sampleapplication.com. What happens after this URL is given in browser ?how will it route to the default one..where does this happens in the application ?
8 Jun 2015 by F-ES Sitecore
Your routeconfig will have code likeroutes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });This means that if no controller is given then use Home and if no action then use...
12 Jun 2015 by Member 11761916
I have a webforms 4.0 application that included MVC controller and view through scaffolding. Compiles fine. On running I get issues AreaRegistration.RegisterAllAreas() in the global.asax.csHere is the stack trace....Could not load file or assembly 'lala' or one of its...
20 Jun 2015 by Member 11780461
I am currently beginning a project that involves communication between a host computer and a machine plc by means of a RS 232 cable. Machine: High Cube II by Lauyans & Co. (It is a small parts storage and retrieval system used to store objects within a vertically large inventory unit shaped...
20 Jun 2015 by OriginalGriff
The first thing to do is look at the kit itself and see what communications capabilities are built into it, and how you can use them - this probably means a look at the manufacturer's site and / or their technical support. There isn't necessarily a "common specification" for serial comms and...
16 Sep 2015 by Black Mamba Elapidae
They say controllers should be thin and should not contain buisness logic , Well I was trying to implement the thin controller. But suppose I have existing code like ,public class HomeController : BaseController{ public ActionResult HomeCapture(HomeModel model) { ...
16 Sep 2015 by Code108
If your code is not thin then every other code that every developer has written is very thick. In other words, your code cannot get thinner than what you already have.
24 Sep 2015 by MrCodeIt
How do I pass the selected value/text from telerik Kendo autocomplete to my Controller? I saw the examples but they are accessing the selected item on the same view NOT passing to the controller. Also I am creating my autocomplete using viewbag as datasource
30 Sep 2015 by Nosfa
Hi all.I cannot pass the values from the textboxes onm a form to the controller.view code $(document).ready(function () { $("#btnSubmit").click(function () { var presc1 = $('#p1').val(), ...
30 Sep 2015 by bharat peggem
Hi, data: "{'presc1':'" + presc1 + "', 'aviad1':'" + aviad1 + "'}",Please Remove '' quotes try this one its work outdata : JSON.stringify({ presc1: presc1 , aviad1: aviad1 }),and one more thing below code your missing semicollon var presc1 = $('#p1').val(), ...
3 Oct 2015 by tuan21
I found some weird things in below code: the mytest function is called 3 times!!! WHY ? Test : {{mytest()}} var app =...
6 Oct 2015 by John C Rayan
Test : {{mytest()}} var app = angular.module('myApp', []); ...
1 Nov 2015 by Member 12027588
Test.cshtml:function test() { document.getElementById(testing).showModal();}function test() { document.getElementById("testing").showModal();}
1 Nov 2015 by Krunal Rohit
Refer this article,Bootstrap Modal Dialog - Loading Content from MVC Partial View[^]-KR
4 Nov 2015 by Member 11798999
$(document).ready(function () { $("#tblJQGrid").jqGrid( { url: 'Default/GetDataForEmployeeJQGrid', datatype: "json", reloadAfterSubmit: true, contentType:...
23 Nov 2015 by Gluups
Hello,I do not know what the title has to do with it, but about your question, if you have Avast anti-virus, never spend time searching about "because it is used by another process" before trying with Avast dis-activated.
25 Feb 2016 by GaneshRfromSpace
Before My question confuses, let me make it very clear. I am an electronics undergrad doing internship for a company which manufactures oven controllers. My 1st task was to write a piece of code in the flash memory to blink the led in that board. I did it successfully through my 1st question in...
22 Mar 2016 by Mikep2
I have two partials inside index.cshtml such as: @Html.Partial("_EnquiryForm", new SharedModels.SC.Enquiry()) @Html.Partial("_MemberLoginForm", new SharedModels.SC.User())Does anyone know why the form submissions keep going to the Index actionresult instead of to their own...
22 Mar 2016 by F-ES Sitecore
The url the data is sent to is governed by the form's "action" attribute, and as you have no action attribute it defaults to the current url, so that will be your Index action. You need to give the form tag in each partial view an action attribute that points to the action you want that form to...
5 Apr 2016 by chemoral87
I want to bind two diference instance to one directive and controllersee example Plunker[^]1. how can i avoid the template, and use the innerhtml of the directive?2. it is the correct manner? the ngFriendController seems uselessWhat I have tried:i have tried to use transclude,...
12 May 2016 by Deepak Kanswal Sharma
I'm New to MVC Application . My problem is while I'm trying to connect to Sql Server2008 . This is giving me the error :- Cannot open database "rsbenggmvc.Models.RsbEnggContext" requested by the login. The login failed.Login failed for user 'DEEPAK-PC\DEEPAK'.Project Name :-...
22 Oct 2020 by listojay
Im having trouble disabling or set textbox to readonly after postback submission.what code do i need from controller to disable a razor textbox in views.please dont suggest to use jquery for me to familiarize mvc thanks.What I have tried:i can do this by default but cant control the...
23 Oct 2016 by F-ES Sitecore
MVC is a server-side technology, you can't use it to dynamically amend the DOM in the browser, so I'm afraid you're going to have to use javascript or jQuery to do this.
30 Oct 2016 by sunil kumar meena
Suppose in a sample application there is a SUBMIT button, and in FORM tag I've alreasdy set POST method. So when I click on submit button it'll automatically execute respective controller's action. This id already there in MVC. Then why do we need AJAX or jQuery for the same purpose, i.e....
30 Oct 2016 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
If you don't want to reload the page, then Ajax is the solution. You can send data to server and do everything without a post back.
28 Nov 2016 by Ben Oats
So I have a controller in codeigniter, I wish to include a session that I have started within the same website but different folder (non codeigniter)the session I would normal use like sosession_start(); $userID = $_SESSION[userid];now I can use $userID var anywhere within that...