MVC :: Make A Method Controller?

Apr 9, 2010

I have a foreach in my view and inside foreach I create a control with unique name:

[Code]....

so, form can have checkboxes:

<input type="checkbox" name="IsProjectA" />
<input type="checkbox" name="IsProjectB" />
<input type="checkbox" name="IsProjectSomeName" />

how to get their values on post method controller (what is the best way).

View 2 Replies


Similar Messages:

Make Mvc Configurable Html.ActionLink Controller / Method

May 7, 2010

I have ascx partial view with html-layout like that

<%=Html.ActionLink<PersonController>(x => x.Publications(param1, param2, ... )) %>

My ascx is pretty big & I'd like to reuse it, changing controller/method in Html.ActionLink with another controller/method. Method of another controller has the same signature as PersonController.Publications. Whats best way how to make controller/method configurable for my layout.

View 1 Replies

C# - Using Grasp Controller With MVC Controller - How To Make An Object Always Visible For A Controller

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

MVC :: How To Transfer Control To A Controller's Method From A Controller's Method?

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

MVC :: AmbiguousMatchException On Controller Method?

Mar 21, 2011

This is my Controller class:

[Code]....

This throws the System.Reflection.AmbiguousMatchException. When I comment the second (HTTP-Post) Create method, it works fine.

View 12 Replies

MVC :: Delete Method In A Controller?

Feb 4, 2011

when i create a controller with create ,delete , etc method

then how to use delete and edit method and what is id parameter in these method.

View 3 Replies

MVC :: Controller Method For Create Not Working

Oct 27, 2010

I'm very new to MVC so this is a simple issue, just can't seem to find any information on why it's happening so turning to the forums. Edit works, delete sort of works (that's another issue in itself), and details works, but create causes an issue. I've debugged the form being passed in and it's always null with default values. It's almost identical code to my edit so I'm not sure why edit works and create won't. I'd show code for the view but since it's working for edit I'm currently ruling that out as the problem. "Colleges" in this populates a dropdown in the view. Here's the code:

[Code]....

View 6 Replies

MVC :: Implement A Controller Method That Does Not Have A View

Dec 29, 2010

i have created a controller method that just update a record in the database.

and i call this method using the following code

<%
: Html.ActionLink("Perform
Calculation",
"Calculate")%>

but the problem is that when i click on the Perform Link an error will be raised indicating that it can not find the Calculate view.

so how i can enforce my application to call the Calculate controller method to perform the update and to keep the user in the current page .(the index page).

View 8 Replies

MVC :: Set Up A Controller Method Do Read A GET Request?

May 26, 2010

I am having trouble finding any information on this but basically in MVC how do I set up a controller method do read a GET request? For example I have the following url,

http://www.mysite.com/events/eventsearch?sdate=31/10/2010&edate=31/12/2010&group=3

Do I just do the following?

[Code]....

I just do not understand how to handle the GET requests in ASP MVC.

View 5 Replies

MVC :: Accepting A Json In A Controller Method?

Oct 10, 2010

I have a JSON object in javascript

it is a collection of Object

How can I pass this object to a controller if i am submitting the form like

$('#myform').submit();

what object type should i give for the parameter to accept this Json

View 5 Replies

MVC :: Make A Div On The Page Hidden From The Controller?

Oct 13, 2010

I'm trying to realise how to make a div on the page hidden, from the controller.

the situation is this:

i have 2 radioboxes, which need to fill a hidden label with thier value, dependant on the one selected.

the second case is gettin the value in the ID part of the link, and hiding the radioboxes altogether.

been googling it for hours and could not find a solution for this?

View 8 Replies

Controller AJAX Method To Return ActionLink

Apr 4, 2011

I am fairly new to MVC and just trying to achieve something which I think shouldn't be too complicated to achieve. Just want to know what the best approach for that is. I have an Event-RSVP application (NerdDinner kind) where you go to view details of the event and then click on an AJAX link that will RSVP you for the event.

<%
if (Model.HasRSVP(Context.User.Identity.Name))
{
%>
<p>

You are registered for this event!

<%:
Ajax.ActionLink("Click here if you can't make it!", "CancelRegistration", "RSVP", new { id = Model.RSVPs.FirstOrDefault(r => r.AttendeeName.ToLower() == User.Identity.Name.ToLower()).RSVPID }, new AjaxOptions { UpdateTargetId = "QuickRegister"})
%>
</p>
<%
}
else
{
%>
<p>................

View 2 Replies

Passing A Controller As A Parameter - Can't Get To RedirectToAction Method

Jun 15, 2010

My method looks like:

public static RedirectToResult(Controller controller, ...)
{
}

when I do:

controller.

I don't see RedirectToAction, how come?

I get RedirectToAction from within the controller's action, but not when I pass the controller as a parameter to another classes method.

View 3 Replies

Controller Method Not Always Called From $.getJSON Request?

Mar 9, 2010

I have a controller method that returns a jSON object and in one calling situation, it works and in another calling situation, it does not work. When the URL in my browser is this:

http://localhost:65247/Client -- it works.

But, when my url looks like this:

http://localhost:65247/Client/UserAdmin?id=6 -- it DOES NOT work

In a nutshell, clients have users. From within the client, I wish to work on a specific user (this is the UserAdmin view). In this case, the client id is 6. From within the UserAdmin view that was launched with Id=6, I then wish to select a user from a dropdown. The idea was to use javascript and $.getJSON to fetch data for the specific user so as not to have to refresh the entire page. I use this approach in other parts of the app. The only difference I can see is with the URL in the browser. It would appear the presence of parameters via the '?' is futzing things up a bit.

View 1 Replies

MVC2 Does Every Single Controller Method Have To Map To A DIFFERENT View?

Sep 16, 2010

In MVC2 does every single controller method have to map to a DIFFERENT view?Or can I make two methods map to the same view?

View 3 Replies

MVC :: What View Is Used When Calling A Controller Method Without ActionResult

Jan 9, 2010

I have just started using MVC. I created the MVC application and was playing around with it.When you call the http://localhost/home/Index/ on the sample MVC application the Index method of the controller home gets invoked and the view Index.aspx is displayed and similarly when we call http://localhost/home/About/ then the About method of the Home controller is invoked and the About.aspx page is displayed

View 2 Replies

Accessing Static MVC Controller Method From View

Mar 16, 2011

I've got an .aspx page with this in it:

<%@ Import Namespace="System.Web.Mvc" %>
<%= AssetController.ScriptTag("/js/Community/CommunityWizard.js")%>

And I have an AssetController class:

Imports System.Web.Mvc
Public Class AssetController
Inherits Controller
Public Shared Function ScriptTag(ByVal src As String) As String
Return String.Format(
"<script type='text/javascript' src='/js.mvc?src={0}&{1}'></script>",
System.Web.HttpContext.Current.Server.UrlEncode(src),
New BuildVersion().ToString()
)
End Function
End Class

The project has a reference added to the 3.0.0.0 version of System.Web.Mvc assembly. When I try to view the page in a browser, I get a HTTP 500 with this message:

BC30007: Reference required to
assembly 'System.Web.Mvc,
Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35'
containing the base class
'System.Web.Mvc.Controller'. Add one to your project.

What gives? I don't understand why I can use this controller everywhere in our ASP.NET Forms/MVC hybrid application, but not in a view. EDIT: In fact, when I type <% System.Web. into the .aspx view, Mvc doesn't even appear in Intellisense!

View 2 Replies

MVC :: Set The Model From Controller Unit Testing Method?

Mar 24, 2011

I am using the Nhibernate with MVC. In the controller i am getting the model from the HttpSession. How can i set the model from controller Unit testing method.

View 1 Replies

Get Controller Method Caller (3rd Party Webservice)?

Jun 5, 2010

Is it possible to retrieve the URL of a 3rd party webservice calling my controller method?
Things like Request.Current.Url refer to my own URL (/someController/someAction/).

The 3rd party webservice is sending HTTP POST data to my /someController/someAction and I wish to send back a HTTP POST message to the caller of the method, the 3rd party webservice, without using

return Content["some response"] which will force me to exit the method. Since the answer is plain text I would like to send it using HTTP Post.

What I actually try to do is respond to the calling webservice without exiting my method (return Content() will exit) so I can call other methods to process the data send to me by the webservice. I want to first tell the webservice I received their stuff and than process, in this way when a processing error occurs the webservice at least will not resend old data. Is there another way to do this than building your own HTTP post?

View 1 Replies

JQuery :: Correct Way To Fire Controller Method?

Feb 19, 2011

I have a form with a drop down list. I want to pass the value of the selected item and a hidden field called stidentid to a controller action that would check my database to see if records for that id and semester exist and return the view with the appropriate values filled in. I'm not really familliar with Javascript or Jquery so I tried this:

[Code]....

}).change();

however nothing happens when I select anything from the semester list not even a crash. What am I doing wrong?

View 25 Replies

MVC :: Controller Method Name For Action With Character Dash '-'?

Aug 1, 2010

I'm using MVC2.

I added routher for url: "autors/year-range/1928/page2"
routes.MapRoute("AuthorsPopular",
"authors/{action}/{param}/{page}",

[code]...

Since Year-Range is invalid method name.

View 2 Replies

Fill View Page Of This Controller Method?

Apr 23, 2010

Why will not fill View page of this controller method

public ActionResult Person()
{
testEntities6 testPersons = new testEntities6();[code].....

View 1 Replies

MVC :: How To Extend Controller With Extension Method Which Redirects To 404 Page

Sep 28, 2010

I am trying to extend controller with extension method which redirects to 404 page.

[Code]....

However, controller.View() method is internal and can't be called outside class methods.

View 3 Replies

How To Call Custom Html Helper From A Controller Method

Dec 30, 2010

I'm trying to write a controller method that returns an ActionResult.

In this method, i would like to:

1. call an HTML helper method

2. Capture and store the HTML helper's rendered HTML in a string

3. Return the method with the rendered HTML wrapped as a JSON

How do i call the Html Helper method from my controller method? Simply using the static class HtmlHelper does not work.

View 1 Replies

MVC :: Getting Values In Html Table To A Controller Action Method?

May 11, 2010

I have an editable table in my view.

how can i accept the whole table in a controller action method?

what parameter should i gave to accept the whole table

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved