How to load partialview into div, without the partialview being attached to a controller?
up vote
0
down vote
favorite
How would I go about loading a partialview in a div? the partialview is not attached to a controller, its just a cshtml page that is going to be using Vue.
I have tried using jquery's load function but keep getting 404 errors when trying to load the partialview, from the shared folder, into the div that I want to use to show it.
Right now I have a navbar that controls the content area on what is shown and not shown and there are a bunch of divs that are hidden that have @HTML.Partial, so all the partialviews are loaded up that way and its starting to be a mess, so I am looking to clear out a bunch of code and just load those partialviews on the navbar items click events
javascript jquery html asp.net-mvc
add a comment |
up vote
0
down vote
favorite
How would I go about loading a partialview in a div? the partialview is not attached to a controller, its just a cshtml page that is going to be using Vue.
I have tried using jquery's load function but keep getting 404 errors when trying to load the partialview, from the shared folder, into the div that I want to use to show it.
Right now I have a navbar that controls the content area on what is shown and not shown and there are a bunch of divs that are hidden that have @HTML.Partial, so all the partialviews are loaded up that way and its starting to be a mess, so I am looking to clear out a bunch of code and just load those partialviews on the navbar items click events
javascript jquery html asp.net-mvc
2
You do not directly access a.cshtmlfile. You get it via an action method. So write an action method which returns this partial view and try to request that from your JavaScript code(loadmethod).
– Shyju
Nov 13 at 1:23
1
Create an action method which returnsPartialViewand use AJAX inside navbar click event handler to render it (usually done withhtml()against target placeholder).
– Tetsuya Yamamoto
Nov 13 at 1:28
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How would I go about loading a partialview in a div? the partialview is not attached to a controller, its just a cshtml page that is going to be using Vue.
I have tried using jquery's load function but keep getting 404 errors when trying to load the partialview, from the shared folder, into the div that I want to use to show it.
Right now I have a navbar that controls the content area on what is shown and not shown and there are a bunch of divs that are hidden that have @HTML.Partial, so all the partialviews are loaded up that way and its starting to be a mess, so I am looking to clear out a bunch of code and just load those partialviews on the navbar items click events
javascript jquery html asp.net-mvc
How would I go about loading a partialview in a div? the partialview is not attached to a controller, its just a cshtml page that is going to be using Vue.
I have tried using jquery's load function but keep getting 404 errors when trying to load the partialview, from the shared folder, into the div that I want to use to show it.
Right now I have a navbar that controls the content area on what is shown and not shown and there are a bunch of divs that are hidden that have @HTML.Partial, so all the partialviews are loaded up that way and its starting to be a mess, so I am looking to clear out a bunch of code and just load those partialviews on the navbar items click events
javascript jquery html asp.net-mvc
javascript jquery html asp.net-mvc
asked Nov 13 at 1:22
Chris
1,06152157
1,06152157
2
You do not directly access a.cshtmlfile. You get it via an action method. So write an action method which returns this partial view and try to request that from your JavaScript code(loadmethod).
– Shyju
Nov 13 at 1:23
1
Create an action method which returnsPartialViewand use AJAX inside navbar click event handler to render it (usually done withhtml()against target placeholder).
– Tetsuya Yamamoto
Nov 13 at 1:28
add a comment |
2
You do not directly access a.cshtmlfile. You get it via an action method. So write an action method which returns this partial view and try to request that from your JavaScript code(loadmethod).
– Shyju
Nov 13 at 1:23
1
Create an action method which returnsPartialViewand use AJAX inside navbar click event handler to render it (usually done withhtml()against target placeholder).
– Tetsuya Yamamoto
Nov 13 at 1:28
2
2
You do not directly access a
.cshtml file. You get it via an action method. So write an action method which returns this partial view and try to request that from your JavaScript code(load method).– Shyju
Nov 13 at 1:23
You do not directly access a
.cshtml file. You get it via an action method. So write an action method which returns this partial view and try to request that from your JavaScript code(load method).– Shyju
Nov 13 at 1:23
1
1
Create an action method which returns
PartialView and use AJAX inside navbar click event handler to render it (usually done with html() against target placeholder).– Tetsuya Yamamoto
Nov 13 at 1:28
Create an action method which returns
PartialView and use AJAX inside navbar click event handler to render it (usually done with html() against target placeholder).– Tetsuya Yamamoto
Nov 13 at 1:28
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272423%2fhow-to-load-partialview-into-div-without-the-partialview-being-attached-to-a-co%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You do not directly access a
.cshtmlfile. You get it via an action method. So write an action method which returns this partial view and try to request that from your JavaScript code(loadmethod).– Shyju
Nov 13 at 1:23
1
Create an action method which returns
PartialViewand use AJAX inside navbar click event handler to render it (usually done withhtml()against target placeholder).– Tetsuya Yamamoto
Nov 13 at 1:28