asp.net


Loading Partial view using Ajax.PartialView in MVC5


I want to load a partial view using Ajax.PartialView() .But while trying so the Partial view is not loading at all.It is hitting AccountController.Login(),but not rendering the Login page Here is my code .
I want to load Login Page in "formbody" div without refreshing Index page . Please give suggestion on it.
Home\Index.cshtml
#{
ViewBag.Title = "Home Page";
}
#using(Ajax.BeginForm(
new AjaxOptions
{
HttpMethod="GET",
InsertionMode=InsertionMode.Replace,
UpdateTargetId = "formbody"
}
))
{
<div class="pager glyphicon-align-center" id="formbody">
<button type="button" id="login" class="btn btn-default btn-lg">
#Ajax.ActionLink("Login", "Login", "Account", new { id = "login" }, new AjaxOptions { })
<span class="glyphicon glyphicon-log-in"> </span> #*Login*#
</button>
<button type="button" class="btn btn-default btn-lg" onclick="location.href='#Url.Action("Register", "Account", new { id = "Registerlink" })'">
</button>
</div >
}
#section scripts {
#*<script src="/Scripts/jquery-1.8.2.js"></script>*#
#Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.min.js")
<script type="text/javascript">
$("#login").click(function () {
$(".nav-tabs").html("<li> <a href='#Tab1'> Login</a></li>");
});
</script>
}
AccountController.Login
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
if (Request.IsAjaxRequest())
{
return PartialView("Login");
}
return View();
}
BundleConfig
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/MicrosoftMvcAjax.js",
"~/Scripts/MicrosoftAjax"));

Related Links

Why shouldn't I use IIS Express for ASP.Net Core development?
Add CompareValidator to TextBox that is hidden until a button is clicked
Read text file from server and split into multiple file in asp.net
How to take only positive number in RadNumericTextBox?
Can I boost Lucene query parser results based on expected data?
Data source name not found / no default driver specified
Using ViewState to apply filters on Listview
Birthday and Gender Google Authentification .Net Core RC2
ASP.NET Visual Basic Code Behind.. Trying to populate a dropdownlist that resides in formview
Why won't my site's preview image show on a Facebook share?
Configuration inheritance in IIS
Many to many relation between Identity and custom table. EF7 - Code first
How can I pass parameter to a link generated by ActionLink() in ASP.NET MVC?
How to update CheckBoxes on the client side after making changes on the server side?
How to find the domain from which a webservice being requested in ASP.NET
Edit/Delete array row from table MVC 4

Categories

HOME
optimization
netty
ide
pelican
liquibase
esxi
confluence-rest-api
checkpoint
yuv
psexec
yacc
pyodbc
spring-data-solr
openbsd
mongoimport
facebook-sharer
aspectj
hdf5
openstack-horizon
tag-cloud
greensock
brightway
simd
uipath
visual-studio-community
cloudformation
typeclass
spring-data-gemfire
ocl
ilog
mootools
incapsula
kofax
extern
libconfig
linkurious
blueimp
wicket-tester
susy
aura-framework
google-cloud-powershell
pexpect
head
azure-data-catalog
npoco
text-formatting
geminabox
g77
hdpi
evaluation
jcs
audio-fingerprinting
playframework-1.x
photoshop-script
typewriter
programming-pearls
ownership
computed-properties
particle-system
gdi
avaudiorecorder
phpdesigner
google-finance-api
pushwoosh
playn
web-standards
nexusdb
douglas-peucker
optimistic-locking
method-overloading
report-builder2.0
go-gin
xmlserializer
lwuit
tigase
disparity-mapping
android-relativelayout
code-smell
pthreads-win32
grunt-wiredep
moonscript
rfc822
custom-cursor
android-memory
diazo
win-prolog
umfpack
mcpd
backlight
cinder
for-xml
mysql-pconnect
file-storage
ironpython-studio

Resources

Encrypt Message