TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jatin jatin
NA
6
3.3k
Section not defined In Index.cshtml in asp.net mvc?
Dec 27 2019 6:32 AM
In MVC get an error:
Section not defined: "alertmethod"
I already define that method in Index.cshtml
_Layout.cshtml
@RenderSection(
"alertmethod"
) // I define this method in index.cshtml that's yI m using rendersection??
<div class="container body-content">
@RenderBody()
@RenderSection("alertmethod")
<footer>
</footer>
</div>
HomeController
public
ActionResult create()
{
return
View();
}
[HttpPost]
public
ActionResult create(studentmvcmodel stud)
{
ViewBag.message =
"data inserted successfully"
;
return
RedirectToAction(
"Index"
);
}
Index.cshtml
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section alertmethod
{
<script src="https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/alertify.min.js" type="text/javascript">
$(function () {
var successmessage = '@ViewBag.message'
if (successmessage != '') //means aani '' length=0 ni alava hovu joiye
{
alertify.success(successmessage);
}
});
</script>
}
How to resolve this issue??
Reply
Answers (
4
)
merge ms word files and create Table of Content
How to add one column in Gridview