MVC :: Can Call The Methods Inside The Controller And Inside The Models "Action Methods"

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

Similar Messages:

Data Controls :: Share Data Between Multiple Action Methods Inside A Controller

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

MVC :: Call And Action / Controller From Inside Jquery?

Nov 17, 2010

How do I call and action/controller from inside a jquery function?

View 3 Replies

Deriving Controller From A BaseController, Then Action Methods Do Not Execute And Response Is Blank

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

Security :: Not Extending MembershipProvider Class And Putting All This Methods In Some Unique Class And Call Its Methods Then?

Sep 16, 2010

I am beginner in web applications development. I started one little project and host it on source forge "". 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

MVC :: Why Are HTML Helper Methods In MVC Are Inside Server Tags

Jan 9, 2010

I am new to MVC. why HTML helper methods are inside asp server tags?

for example <%=Html.Textbox("Textbox1")%>

are they equivalnet to web form server tags. Like in web forms we have

<asp:TextBox runat="server"></asp:TextBox>

If someone can kindly explain.

View 1 Replies

Web Forms :: How To View Code Written Inside Methods Provided By Visual Studio

May 5, 2013

Is it possible to view the code written inside DateTime.IsLeapYear()[view the code inside IsLeapYear()]?

If yes then how can one see it?

View 1 Replies

MVC :: Overridden Action Methods (bug)?

Jan 5, 2010

another contribution to the T4MVC template, this time a bug fix.The template changes non-virtual methods to virtual so that they can be overriden. However, this fails when the action method overrides a base method. For example:


The T4MVC template will modify the ExampleController.ExampleAction method to incorrectly become "virtual override":


The fix is to modify the "ProcessControllerActionMethods" method and replace the line that determines whether the method can be overriden with:


View 4 Replies

Using Extension Methods In Static Methods On Extended Classes?

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

Web Forms :: How To Change This Methods In To Use Dictionary Or Extension Methods

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 I am still learning..

View 12 Replies

MVC :: Can't Debug The Action Methods Of The Controllers

Mar 8, 2011

I'm currently using mvc 3 on vs 2010, i can't debug the action methods of the controllers (if its a ajax call/request).

View 6 Replies

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

MVC :: How To Pass Values To Action Methods Without Parameters

Jan 20, 2010

Is there any possibility to pass values of form elements to action methods but using parameters?I have a form with a lot of input fields and the method signature will get pretty long. Besides the form elements depend on each other so if the user makes a special choice only a subset of the form elements should be displayed so there are several combinationof values to be passed.Can I access the posted values in a generic way through a collection in the controller or something similar?

View 3 Replies

MVC :: AntiForgeryToken And Logon - Register Controller Methods

Apr 5, 2010

should AntiForgeryToken be used with every post actions including user logon - register etc...?

View 2 Replies

MVC :: Calling Action Methods Based On Specific Button Click?

Jun 29, 2010

In the create aspx page i have 2 buttons. One for creating the new customer and another one for searching the customer based on the customer last name. Now the issue is when i try to search the customer based on the last name the page is calling the create action method only, not the search action method. how to call a spicific action method from the buttons. I know it can be done using ajax post back but what i am looking at is to achive this in the normal post back itself.

View 3 Replies

MVC :: Methods To Passing Additional Data From Controller To View

Apr 29, 2010

I am getting started with 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:


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

MVC :: Large Number Methods In The Controller Vs A Case Statement

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

How To Call Methods On Object

Oct 17, 2011

I'm teaching myself web services at the moment and I've hit a bit of a stumbling block:-I've implemented a set of services for ordering shutters.These services use an underlying object model consisting of an order and a shutter class.The CreateOrder Service returns an order object and I now want to be able to add shutters to it by calling myOrder.Add(myShutter).

The problem is that the site I'm using to test it can't "see" the Add method on Order. If I browse the object tree I can see the Order Object but when I drill into it no methods are visible. Is this something to do with the way I've added th reference. edit> I just found the class in the "Reference.vb" file and aded this to it:-

Public Sub Add(ByVal Shutter As Shutter)
End Sub

Just about to test that. edit>I found this site and what he sugests fixes the problem but...I've had to add a local reference to the ObjectModel project to the web site. That seems wrong to me. It's not a web reference so how will this work in the real world. Once I actually deploy the service a project on a remote client isn't going to understand a local reference is it?

View 5 Replies

Call Web Methods Of WebService In Javascript

Nov 5, 2010

I'm doing a project in with a web services. My web services and my project is separate and my projet have a reference of my web services. i'm using visual studio 2008 framework 3.5 and my service web is in i want to call the web methods of my web services in javascript my script manager is declared

<asp:ScriptManager runat="server" ID="scriptManager" EnablePageMethods="true" >
<asp:ServiceReference path="http://localhost:2931/ServiceCompas.asmx"/>
the javascript fuctions
<script type="text/javascript">
function test() {
function Onsucced(resultat) {
alert('je suis passée');

service1 is the class of my Webservice and i call the function test with my button <input name="btnRecherche" class="btnRechercher" type="button" value="Rechercher un emplacement" onclick="test()" /> the problem is : JavaScript say Service1 is not defined but why .... What's the problem ? I've checked many forums and videos every body did it
sorry for the french variable

View 3 Replies

WCF / ASMX :: Allow Web Methods To Be Call From Javascript

Jan 8, 2011

i have created a simple WCF webserivce and it is running at http://localhost:2699/WCFServiceClient/myService.svc

with method


i have tested it from a wcftestclient it is working fine.

but when i try to call this method from jquery, it doesn't response.

my jquery code

$.ajax({ type: "POST", url: "http://localhost:2699/WCFServiceClient/myService.svc/GetData", data: { 'value': 5 }, contentType: "application/json; charset=utf-8", dataType: "text/xml; charset=utf-8",
success: function (msg) { alert$(msg.d); }, error: function (e) { alert("Unavailable"); } }); }

View 1 Replies

AJAX :: Restrict To Call Web Methods?

Aug 25, 2010

Scenario is, I have a tab container inside which I placed 5 tabs and each tab having 4 Cascaded dropDown.Now for changing the tab page everytime refreshed and calling all 5 parent control dropwdown to fill.But can I prevent it in that manner so that for changing the tab only that parent webmethods will be called to populate.In page load itself it will call only the active tab parent Cascading dropdown web method.

View 8 Replies

AJAX :: Can Not Call Two Different Pagemethods With Two Service Methods

Oct 1, 2010

I am using an AJAX dropdownlist control with two dropdownlist. Instead of using a webservice to populate the data, I used the pagemethod to populate. My problem is the second droplist won't populate. I get a server error, 500 in the droplist. The first droplist populates fine.

BUT here's the real kicker. If I reverse the order of the public static function such that GetHelloList2 comes BEFORE GetHelloList1 in the code, then the GetHelloList2 works ...... it just seems like it is only firing one pagemethod event and allowign only one.


View 5 Replies

How To Call Aspx Content Page Methods From Usercontrol

Jun 14, 2010

How can I call aspx content page methods from usercontrol?

View 2 Replies

AJAX :: Call Web Service Methods Using Soap Headers .Net 2.0?

Feb 2, 2010

I have a web service/wsdl file that requires client authentication to passed through SOAP headers.

There is not property or method available in web service to set the SOAP headers.

how to call the web service method along with SOAP headers in .NET 2.0

View 7 Replies

AJAX :: Change Propery From JS. Call C# Methods From JavaScript?

Mar 20, 2010

At me is user control. I cannot change its property from JavaScript in any way(SectionName) . I can not understand in what a problem?

ratingElement = document.getElementById('ctl00_MainContent_rating_rating_RatingExtender_ClientState');
function handleStateChange() {
if (xmlHttp.readyState == 4) {


View 8 Replies

Copyrights 2005-15, All rights reserved