tags:

views:

21

answers:

1

Well the Question is related to a problem I posted before (http://stackoverflow.com/questions/2403899/asp-net-mvc-partial-view-does-not-call-my-action). In practice I've a partial view which contains a Form, after submitting the Form the Controller returns the Partial View.

Well the Problem is if I reload the page which contains the partial view the function <%= Url.Action("ChangePassword", "Account") %> returns "Account/ChangePassword", if I submit the form and the partial is returned by the controller.

Using return PartialView() the function <%= Url.Action("ChangePassword", "Account") %> returns only "ChangePassword".

Any Idea because?

The View looks like:

<form action="<%= Url.Action("ChangePassword", "Account") %>" method="post" id="jform"> 
    <div> 
        <fieldset> 
            <legend>Account Information</legend> 
            <p> 
                <label for="currentPassword">Current password:</label> 
                <%= Html.Password("currentPassword") %> 
                <%= Html.ValidationMessage("currentPassword") %> 
            </p> 
            <p> 
                <label for="newPassword">New password:</label> 
                <%= Html.Password("newPassword") %> 
                <%= Html.ValidationMessage("newPassword") %> 
            </p> 
            <p> 
                <label for="confirmPassword">Confirm new password:</label> 
                <%= Html.Password("confirmPassword") %> 
                <%= Html.ValidationMessage("confirmPassword") %> 
            </p> 
            <p> 
                <input type="submit" value="Change Password" /> 
            </p> 
        </fieldset> 
    </div> 
</form> 
</div> 

<script> 
    $(function() { 
        $('#jform').submit(function() { 
            $('#jform').ajaxSubmit({ target: '#FmChangePassword' }); return false; 
        }); 
    }); 
</script> 

Part of the Controller:

    if (!ValidateChangePassword(currentPassword, newPassword, confirmPassword)) 
    { 
        return PartialView(ViewData);                 
    } 
A: 

Try using Html.BeginForm

http://msdn.microsoft.com/en-us/library/dd492714(v=VS.90).aspx

thealliedhacker
Tranks for the try, I tried using Html.BeginForm but it didn't work. But even if it would, it seems strange to me that the Helper <%= Url.Action("ChangePassword", "Account") %> does not work in my enviornment.
john84