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
احمد صدقی
NA
106
17.3k
Not working my Sweet Alert
Mar 21 2019 8:09 AM
I am using sweet alert but still my alert is not working.
This is my View
@model SSC_MVC.Models.Department
@{
// ViewBag.Title = "Create";
ViewBag.Title = Model.dpt_id ==
null
?
"Create"
:
"Edit"
;
}
<script src=
"~/Scripts/jquery-1.12.4.min.js"
>
</script>
<script src=
"~/Scripts/jquery.validate.min.js"
></script>
<script src=
"~/Scripts/jquery.validate.unobtrusive.min.js"
></script>
<link href=
"~/bootstrap-3.3.6-dist/css/bootstrap.min.css"
rel=
"stylesheet"
/>
<script src=
"~/bootstrap-3.3.6-dist/js/bootstrap.js"
></script>
<script src=
"https://lipis.github.io/bootstrap-sweetalert/lib/sweet-alert.js"
></script>
<link href=
"~/Content/sweetalert/sweet-alert.css"
rel=
"stylesheet"
/>
<script type=
"text/javascript"
>
function
validateData()
{
debugger
;
if
($(
"#dpt_nam"
).val() ==
""
)
{
swal(
"Please enter OrderCode !"
);
return
false
;
}
else
{
return
true
;
}
}
</script>
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div
class
=
"col-md-12 form-horizontal"
>
<h4>Department</h4>
<hr />
@Html.ValidationSummary(
true
,
""
,
new
{ @
class
=
"text-danger"
})
@Html.HiddenFor(model => model.dpt_id)
<div
class
=
"form-group"
>
<div
class
=
"col-md-2"
>
@Html.Label(
"Name"
, htmlAttributes:
new
{ @
class
=
"control-label col-md-2 "
})
</div>
<div
class
=
"col-md-8"
>
@Html.EditorFor(model => model.dpt_nam,
new
{ htmlAttributes =
new
{ @
class
=
"form-control validateData"
} })
@Html.ValidationMessageFor(model => model.dpt_nam,
""
,
new
{ @
class
=
"text-danger"
})
</div>
</div>
<div
class
=
"form-group"
>
<div
class
=
"col-md-offset-2 col-md-10"
>
@
if
(Model.dpt_id ==
null
)
{
<input type=
"submit"
onclick=
"Validate(this, event);"
value=
"Create"
class
=
"btn btn-primary"
/>
}
else
{
<input type=
"submit"
value=
"Edit"
class
=
"btn btn-success"
/>
}
</div>
</div>
</div>
}
<div>
@Html.ActionLink(
"Back to List"
,
"Index"
)
</div>
@*@section Scripts {
@Scripts.Render(
"~/bundles/jqueryval"
)
}*@
This is my Model:
public
class
Department
{
public
string
dpt_id {
get
;
set
; }
[Required(ErrorMessage =
"Please enter Department Name"
)]
public
string
dpt_nam {
get
;
set
; }
public
string
dpt_typ {
get
;
set
; }
}
Reply
Answers (
3
)
Display Google Map in PartialView
public partial class form: System.Web.UI.Page