MVC :: Interacting With Different Methods Of A Controller
Feb 3, 2011
I am having two methods inside a controller like1.public ActionResult ProfileView(int UID){}2.public ActionResult UpdatingAthleticInfo() { }How to call ProfileView method and pass UID parameter from UpdatingAthleticInfo method ??
View 2 Replies
Similar Messages:
Mar 21, 2011
i have a repository class inside my model folder; this repositiry contains many methods , which are called from Action methods in the controllers; so my question is :- if i have a method insidle my model.reporsitory which calls a stored procedure, then can i call it an "action method"? or "action method" expression only apply to controller methods?
View 4 Replies
Apr 5, 2010
should AntiForgeryToken be used with every post actions including user logon - register etc...?
View 2 Replies
Apr 29, 2010
I am getting started with Ap.net MVC. For that i chose to practice it by build an application. Im using MVC 2 and Linq To SQL, and i would like to passing another Query to the view. For example, i have this:
[Code]....
So i would like to pass data1 and data2 to the View. I can use return View(data1), but the View function accept just one data. So what technique i can use to pass the tow data to the view
View 5 Replies
Feb 11, 2011
Working on a heavy ajax based site with over 100 methods from all the ajax calls inside each of each controller all with basically the same code.Was thinking of changing them to a big case statement for readability which would keep the code a bit more dry and make it easier to read.What I am wondering is: Will there be a performance hit and is there a better way to deal with it?
View 4 Replies
Mar 20, 2011
I wanted to create a CurrentUser object to be accessible in every Action of Controller, I initialized it in Constructor but User.Identity was not available in Constructor. I followed the following link on stackoverflow:
Defining a User with User.Identity.Name in controller constructor
But after inheriting my Controllers from BaseController, my Action methods are not even executed, the execution stops at Execute of BaseController and I get blank pages in the browser.
View 1 Replies
Mar 17, 2014
I have one controller with 4 to 5 action method. In all action method i have to check some feilds from database. So to reduce the database query i want to save this data one time and then want to use that in all action method. I know about tempdata and view bag but none of this can use in different action method, so how to achive this.
View 1 Replies
Jul 7, 2010
I am try in to get the ClientID of one of my server controls to appear in a Javascript in my aspx page.
Obviously I am going about it the wrong way, but my intent should be made clear in the following:
doSomethingFirst();
var hid = "<% Response.Write(HidingField.ClientID) %>";
doSomethingElse(hid);
View 3 Replies
Nov 27, 2010
I've been designing a website which has a grid on the page. The grid has multiple comboBoxes within it. These comboboxes interact. ie When one value is changed by the user another one has it's value change or is disabled/enabled etc.I find in order to do this I have to use FindControl a lot. Like in the selectedindexchanged event of one combobox I'll need to find another comboBox.This seems rather a messy way of doing things. It also seems like it leaves the system open to errors the compiler won't find say if a combobox has it's id changed later on down the line.
View 4 Replies
Mar 10, 2011
Microsoft release a product named - Visual Studio Load Test Virtual User Pack 2010 to do that. However, it cost USD$4,799. So,is it other free or commercial tool can do simulate jobs? At now, my solution is :
Winform :
3 x virtualbox + WinXP with some macro software.
ASP.NET
3 x virtualbox + WinXP + Firefox and iMacro
View 3 Replies
Dec 28, 2010
UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.
View 1 Replies
Sep 19, 2010
This is not a programming question per se, but rather an attempt to find the adequate technology to use for my objective. My mandate is to build an ASP.NET Web Application. However, on certain pages, some client-side information needs to be fetched by interacting with hardware on the client's computer, for example a barcode reader or an RFID tag reader. My first reflex was to think "ActiveX" controls with, perhaps, some AJAX coding to fetch the required values from said control. However, I am not sure if I am up to date with the latest tech trends. The solution I'm looking for will let me design a user control that plugs into my ASP.NET Web Application, lets me interact with client-side hardware, and can be automatically downloaded from the Web Application itself (I can't predict which computers will access my Web Application). Which technology(ies) should I go for?
View 2 Replies
Aug 16, 2010
I have an extension method as follows:
public static class PageExtensions
{
public static int GetUserId(this Page targetPage)
{
var user = Membership.GetUser(targetPage.User.Identity.Name);
return (int)user.ProviderUserKey;
}
}
Now in a page I need to use this method in a static WebMethod, so I have added another 'extension method' to PageExtensions:
public static int GetUserId()
{
return (int)Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;
}
and I call it as follows in my WebMethod: PageExtensions.GetUserId()
View 1 Replies
Jul 23, 2010
public class CacheHelper { /// <summary> /// Removes object with the specified key. /// </summary> /// <param name="key">The key.</param> [code]....
I have this methods for caching..I need to change this methods to use in aDictionary<string,object>
How do I need to change this code Because I am new to asp.net I am still learning..
View 12 Replies
Sep 16, 2010
I am beginner in web applications development. I started one little project and host it on source forge "https://homoco.svn.sourceforge.net/svnroot/homoco". And I started implementing authentication in this application to learn how it works. From my experience people never use out of the box things so I want to implement this stuff alone (like in real world projects). So some questions:
1) Is there any reason to use membership out of the box? To use database table schema, stored procedures etc. that tool generate for developer. I think that this lower control over code and I decided to implement it my self. I don't know if I am right.
2) Is my approach in this demo project good or bad (if someone have time I like to do just a little code review)? I created database based on business rules. Not using database schema that membership provider require. Extend "MembershipProvider" class to satisfy my needs. Implement queries to database myself.
3) Now, this question is a little wired but I have to ask it. If we make custom Membership Provider and do sql queries alone, implement all MembershipProvider class methods ourselves, and in application use Membership.blabla() why is this approach different from not extending MembershipProvider class and putting all this methods in some unique class and call its methods then? I hope that someone understand what I ask here.
I am sorry for three questions, but I really trying to find the best way to implement this feature in my demo project like it is a real world application.
View 3 Replies
Nov 6, 2010
my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.
Function Delete(ByVal id As Integer) As ActionResult
View 4 Replies
Aug 16, 2010
I have a simple model where a Person has Gifts. I have a view which is a list of Gifts belonging to one Person.
My problem is with the Create action for a new Gift. I want it to default to the PersonID that we are already viewing the list of Gifts for. I tried simply passing the last PersonID (they are all the same)
Html.ActionLink("Create New", "Create", new { id = Model.Last().PersonID }) which works fine if there is already at least one Gift for that person but if this is the first Gift I don't have a value.
My Gift List controller knows the PersonID I want to pass but the view doesn't.
How do I pass this PersonID from my Gift List controller to my Gift Create controller via the Gift List view? Or is there a better way to do this?
View 2 Replies
May 30, 2010
I have a filter on my MVC web site. I display some records in a few different controller actions but when moving from one action to another I want to apply those filter values.
How can I persist values from controller to controller?
Should I use Session? TempData?
I am using Structure Map for IOC.
Maybe I could have a class that contains a Property for each Session Value that I use in my application and inject it on the controllers that need session?
View 10 Replies
Mar 14, 2011
How do you get the current action / controller name in a controller or class?
i can't show it in my view but that's not what i want.
View 1 Replies
Jul 22, 2010
C#: HomeController.vb: works fine HttpPost RsvpForm gets the object filled with user input.
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using RsvpInC.Models; namespace RsvpInC.Controllers{ public class HomeController : Controller { //
[code]...
View 5 Replies
Jan 24, 2011
I have a User entity and a department entity. I have a UserViewModel and DepartmentListModel which has List of departments.
UserViewModel has a property of type DepartmentListModel .
Now on user/create action I need to populate DepartmentListModel by calling DepartmentController's list action. List action returns populated DepartmentListViewModel.
From UserController how do I set DepartmentListModel ?
I tried doing so
[Code]....
But RedirectToAction returns RediretToRouteResult
View 7 Replies
Mar 11, 2010
We say that "GroupBy" and "OrderBy" methods from LINQ as Extension Methods.Then how about "variable.ToString()" and "string.Split()" menthods. Are these Extension methods.
View 2 Replies
Mar 11, 2010
Say I have several Areas that are baed on user roles.Differnet roles have different functionality, but also have some "shared" functionality like say "Payments"Now, I created a PaymentController (and it's views for listing, creating messages) in Shared (not an area) and it works fine.
Would it be possible (and how?) to create a PaymentsController class in one of the Areas, have that inherit the PaymentController Class in Shared?
If I can do this, I can successfully share common functionality across areas, and at the same time extend the derived controller to include some 'area specific' functionality to common shared controllers. (Such as the "REturn to xxxx" text and route of the returnurl, which are a bit more complicated than I just made it sound)
View 3 Replies
Jan 19, 2011
How can i transfer control to a controller's method from a controller's method..I am having two Controllers Home and User.. After username and password are verified inHome Controllers method , i want to show the User Controllers index page , so i have to callindex method of Home controller..How can i do it.
View 5 Replies
Dec 9, 2010
I developed a DLL in C# When I am trying to call it I get: System.EntryPointNotFoundException: Unable to find an entry point named: It means that DLL doens't export any methods visible from DLL. Dumpbin doesn't show any methods either:
dumpbin.exe -exports ActiveXTest.dll
Dump of file ActiveXTest.dll
File Type: DLL
Summary
2000 .reloc
2000 .rsrc
2000 .text
What's wrong? The DLL looks ok.. according to documentation:
Csharp Code:
namespace Kosmala.Michal.ActiveXTest
public static void setHooks()
{
....
}
Here is how I call it:
Csharp Code:
namespace IWFHotkeyStarter
{
class Program
{
[DllImport("D:\work\iwf\_ctrl-tab-modless_dlg_testing\activex\VSProjects\AcriveXSourceCode\bin\Debug\ActiveXTest.dll")]
public extern static void setHooks();
static void Main(string[] args)
{
Program p = new Program();
p.run();
}
private void run(){
Console.WriteLine("run<<");
setHooks();
Console.WriteLine("run>>");
}
}
}
View 2 Replies