i have a view in which there is a section and in section there are some links; section and one link are like this:
<section id="tabs-section">
<ul id="myTab" class="my-nav nav nav-tabs nav-justified responsive-tabs col-sm-12" style="padding:0;">
<li class="active"><a href="#RegisterEditUsers" data-toggle="tab">A</a></li>
</ul>
<div class="tab-content col-sm-12" style="border:1px solid #000000;"@*margin-top:-20px;padding-top:20px;*@>
<div class="tab-pane fade in active" id="RegisterEditUsers">@Html.Partial("RegisterEditUsers")</div>
</div>
when i click on A a partial view in this view is shown under links. partial view is like this:
<div class="panel" style="border:1px solid #ff6a00;margin:10px 10px 0
10px;padding:10px;">
<div class="row ">
<div id="register" class="col-sm-6 col-sm-offset-0 col-sm-pull-0
col-sm-push-6 col-xs-offset-3 col-xs-pull-1 btn btn-circle ">
@Ajax.ActionLink("AA", "Register", "Account", new AjaxOptions {
HttpMethod = "Get", UpdateTargetId = "Result", InsertionMode =
InsertionMode.Replace, OnComplete = "regClick" })
</div>
<div id="edit" class="col-sm-6 col-sm-offset-3 col-xs-offset-0 btn
btn-circle">
@Ajax.ActionLink("BB", "GetUsers", "UsersAdmin", new AjaxOptions
{ HttpMethod = "Get", UpdateTargetId = "Result", InsertionMode =
InsertionMode.Replace, OnComplete = "edClick" })
</div>
</div>
</div>
<div class="panel" style="border:1px solid #ff6a00;margin:0px 10px 10px
10px;">
<div id="Result" dir="rtl"></div>
</div>
and finally when i choose AA a new partial view is loaded bellow the former partial view, that is this:
@using (Ajax.BeginForm(
"Register",
"Account",
null,
new AjaxOptions
{
HttpMethod = "Post",
UpdateTargetId = "IdentifyPerson",
InsertionMode = InsertionMode.Replace
}))
{
@Html.AntiForgeryToken();
@Html.ValidationSummary(true, "", new { @class = "text-danger" });
<div id="IdentifyPerson" style="padding:10px">
<div class="panel" style="padding:10px; direction:rtl">
<div class="row">
<div class="form-group col-md-2">
<label class="sr-only" for="LastName">:</label>
@*<input type="text" class="form-control" id="LastName"
placeholder="" name="LastName">*@
@Html.TextBoxFor(c => c.LastName, new { @class = "form-
control", placeholder = "" })
@Html.ValidationMessageFor(model => model.LastName, "",
new { @class = "text-danger" })
</div>
</div>
<div class="row">
<div class="pull-left">
<button type="submit" id="RegisterBtn"
name="RegisterBtn" class="btn btn-info" style="padding:10px">AAA</button>
</div>
</div>
</div>
</div>
}
everything goes Good until i click on submit button (AAA), nothing is happened. i also use this line in my pages:
<script type="text/javascript"
src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")"></script>
if i use HTML.BeginForm instead of Ajax.BeginForm submit button works fine but in return part, when i want to load the second partial view, it is loaded as a view!! Question: what i want is: when i click on submit button Ajax.BeginForm or HTML.beginForm works and returned page shows as partial view not a view. any one can help me?
thanks to Stephen Muecke, it seems that bundle not work properly. i don't know why really, i just added these four lines directly to partial view and it work fine :)
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-
3.1.1.min.js")"></script>
<script type="text/javascript"
src="@Url.Content("~/Scripts/jquery.validate.js")"></script>
<script type="text/javascript"
src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")"></script>
<script type="text/javascript"
src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")"></script>