tags:

views:

149

answers:

1

I have a UserControl that I call with Html.RenderAction(...), so far so good..
Then I want to specify in the user control, which action should be used

Html.BeginForm("DeleteComment", "Comments", new { Id = "frmDelete" }, FormMethod.Post);%>
  <%= Html.SubmitImage( "imgbtnDelete", "/image.png", new { ... })%> 
<% Html.EndForm(); %>

And therein lies my problem; this calls the user control's controller/action.

What I want to happen is to call the pages action first and then be able to specify what action to call on the user control's controller.

Is this possible?? Thanks from an MVC noob

A: 

A simple solution would be to set the action of the form to be /{sub-controller}/{action-method}

Something like

Html.BeginForm("DeleteComment", "Comments", new { Id = "frmDelete", action="/{sub-controller}/{action-method}" }, FormMethod.Post);%>

HTH,

Dan

Daniel Elliott
The thing is that this control is on multiple pages, so I want the default Controller / Action to fire and then be able to specify which sub controller/action to use. So I cant use the "DeleteComment", "Comments" part
iammaz
Could you pass the relevant "action" down in ViewData or your model?
Daniel Elliott