Не могу читать ненавязчиво, несмотря ни на что

1

Я знаю, что этот вопрос задавался раньше, но я к вам пришел, потому что не могу найти решение

Я просто не могу прочитать ненавязчивую функцию

Я попытался поместить страницу "Мастер" на странице "Мой просмотр", это не помогло:

<script type="text/javascript" src="~/Scripts/jquery.validate.js"></script>

<script type="text/javascript" 
src="~/Scripts/jquery.validate.unobtrusive.js"></script>

Я попытался изменить порядок добавления этих скриптов, и это не помогло

Я попытался добавить следующее в конфигурацию пакета, и это не помогло:

bundles.Add(new 
ScriptBundle("~/bundles/jqueryval").Include("~/Scripts/jquery.validate.js", 
"~/Scripts/jquery.validate.unobtrusive.js", 
"~/Scripts/jquery.unobtrusive*"));

Моя проблема

Я хочу прочитать это, когда открываю Edit Partial View, но он просто не читает .unobtrusive

Я понятия не имею, что еще попробовать. Пожалуйста, помогите мне.

EDITED по запросу Здесь мой Edit Partial View

    @model VMS.Models.VolunteerInfo

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Edit Volunteer</title>
</head>
<body>
    @using (Html.BeginForm(new { id = "EditForm" }))
    {
        @Html.AntiForgeryToken()

        <div class="form-horizontal">

            @Html.ValidationSummary(true, "", new { @class = "text-danger" })
            @Html.HiddenFor( model => model.VolunteerId)
            <div class="form-group">
                @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control", disabled = "disabled" } })
                    @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                    @Html.HiddenFor(model => model.Name)
                </div>
            </div>

            @*<div class="form-group">
                @Html.LabelFor(model => model.BirthdayDay_AnniversaryDate, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.BirthdayDay_AnniversaryDate, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.BirthdayDay_AnniversaryDate, "", new { @class = "text-danger" })
                </div>
            </div>*@

            <div class="form-group">
                @Html.LabelFor(model => model.PhoneNumber, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.PhoneNumber, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.PhoneNumber, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Address, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextAreaFor(model => model.Address, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.Address, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.EmailAddress, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.EmailAddress, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.EmailAddress, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.Label("Who the donatin is for?*", htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.DonationForWhom, new { htmlAttributes = new { @class = "form-control"} })
                    @Html.ValidationMessageFor(model => model.DonationForWhom, "", new { @class = "text-danger" })
                </div>
            </div>

            @*<div class="form-group">
                @Html.LabelFor(model => model.OccasionsID, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.OccasionsID, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.OccasionsID, "", new { @class = "text-danger" })
                </div>
            </div>*@

            <div class="form-group">
                @Html.LabelFor(model => model.DonationKind, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.RadioButtonFor(v => v.DonationKind, "Money", new { id = "RadioMoney", name = "RadioMoney" }) Money
                    @Html.RadioButtonFor(v => v.DonationKind, "Kind Donation", new { id = "RadioKindDonation", name = "RadioKindDonation" }) Kind Donation
                    @Html.ValidationMessageFor(model => model.DonationKind, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                @Html.Label("Donation Value*", htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.DonationValue, new { htmlAttributes = new { @class = "form-control"} })
                    @Html.ValidationMessageFor(model => model.DonationValue, "", new { @class = "text-danger" })
                </div>
            </div>

            @*<div class="form-group">
                @Html.LabelFor(model => model.DateWhenVolunteerWasAdded, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.DateWhenVolunteerWasAdded, new { htmlAttributes = new { @class = "form-control" } })
                    @Html.ValidationMessageFor(model => model.DateWhenVolunteerWasAdded, "", new { @class = "text-danger" })
                </div>
            </div>*@

            <div class="form-group">
                @Html.LabelFor(model => model.DateDonationToBeUsed, htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.EditorFor(model => model.DateDonationToBeUsed, new { htmlAttributes = new { @class = "form-control", placeholder = "mm/dd/yyyy" } })
                    @Html.ValidationMessageFor(model => model.DateDonationToBeUsed, "", new { @class = "text-danger" })
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Save" class="btn btn-success" />
                </div>
            </div>
        </div>
    }

</body>
</html>

Здесь мой Rendered html

    <div class="modal fade in" id="EditVolunteerModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="display: block; padding-left: 16px;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title" style="font-weight: bold; font-size: 25px">
                        Edit Volunteer Details
                    </h4>
                </div>
                <div class="modal-body">






    <meta name="viewport" content="width=device-width">
    <title>Edit Volunteer</title>


<form action="/ViewEditVolunteer/EditVolunteerById/EditForm" method="post"><input name="__RequestVerificationToken" type="hidden" value="O8t6hn4Adgwtsp24r3Ta83DzdkCcwAhq9Tyxsq2pIgJi_MPzeT9d6p5FelIEJAyX3A-1nu5i5_hWbzGltSTWBx0Ry02jsHqpnYf58_K4gx41">        <div class="form-horizontal">


            <input data-val="true" data-val-number="The field VolunteerId must be a number." data-val-required="The VolunteerId field is required." id="VolunteerId" name="VolunteerId" type="hidden" value="1063">
            <div class="form-group">
                <label class="control-label col-md-2" for="Name">Name*</label>
                <div class="col-md-10">
                    <input class="form-control text-box single-line" data-val="true" data-val-required="Name is required" disabled="disabled" id="Name" name="Name" type="text" value="Nikhil">
                    <span class="field-validation-valid text-danger" data-valmsg-for="Name" data-valmsg-replace="true"></span>
                    <input id="Name" name="Name" type="hidden" value="Nikhil">
                </div>
            </div>



            <div class="form-group">
                <label class="control-label col-md-2" for="PhoneNumber">Phone Number*</label>
                <div class="col-md-10">
                    <input class="form-control text-box single-line" data-val="true" data-val-number="The field Phone Number* must be a number." data-val-required="Phone number is required" id="PhoneNumber" name="PhoneNumber" type="number" value="0">
                    <span class="field-validation-valid text-danger" data-valmsg-for="PhoneNumber" data-valmsg-replace="true"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-2" for="Address">Address</label>
                <div class="col-md-10">
                    <textarea cols="20" htmlattributes="{ class = form-control }" id="Address" name="Address" rows="2">sndkas</textarea>
                    <span class="field-validation-valid text-danger" data-valmsg-for="Address" data-valmsg-replace="true"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-2" for="EmailAddress">Email*</label>
                <div class="col-md-10">
                    <input class="form-control text-box single-line" data-val="true" data-val-regex="Email is not valid" data-val-regex-pattern="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" data-val-required="Email is required" id="EmailAddress" name="EmailAddress" type="text" value="[email protected]">
                    <span class="field-validation-valid text-danger" data-valmsg-for="EmailAddress" data-valmsg-replace="true"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-2" for="Who_the_donatin_is_for__">Who the donatin is for?*</label>
                <div class="col-md-10">
                    <input class="form-control text-box single-line" id="DonationForWhom" name="DonationForWhom" type="text" value="Nikhil">
                    <span class="field-validation-valid text-danger" data-valmsg-for="DonationForWhom" data-valmsg-replace="true"></span>
                </div>
            </div>



            <div class="form-group">
                <label class="control-label col-md-2" for="DonationKind">What kind of donation?*</label>
                <div class="col-md-10">
                    <input data-val="true" data-val-required="Please select one" id="RadioMoney" name="DonationKind" type="radio" value="Money"> Money
                    <input checked="checked" id="RadioKindDonation" name="DonationKind" type="radio" value="Kind Donation"> Kind Donation
                    <span class="field-validation-valid text-danger" data-valmsg-for="DonationKind" data-valmsg-replace="true"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-md-2" for="Donation_Value_">Donation Value*</label>
                <div class="col-md-10">
                    <input class="form-control text-box single-line" data-val="true" data-val-required="Please Enter Value" id="DonationValue" name="DonationValue" type="text" value="50Kg Daal">
                    <span class="field-validation-valid text-danger" data-valmsg-for="DonationValue" data-valmsg-replace="true"></span>
                </div>
            </div>



            <div class="form-group">
                <label class="control-label col-md-2" for="DateDonationToBeUsed">What day the donation is to be used?</label>
                <div class="col-md-10">
                    <input class="form-control text-box single-line" id="DateDonationToBeUsed" name="DateDonationToBeUsed" placeholder="mm/dd/yyyy" type="text" value="07/08/2018">
                    <span class="field-validation-valid text-danger" data-valmsg-for="DateDonationToBeUsed" data-valmsg-replace="true"></span>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Save" class="btn btn-success">
                </div>
            </div>
        </div>
</form>    



</div>
            </div>
        </div>
    </div>
  • 0
    Не могли бы вы показать код редактирования частичного просмотра?
  • 0
    Пожалуйста, покажите визуализированный HTML
Показать ещё 6 комментариев
Теги:
asp.net-mvc

1 ответ

0

jquery.validate.unobtrusive.js это зависит от jquery.

jquery.js ли вы jquery.js? Также убедитесь, что jquery.js должен быть помещен перед jquery.validate.unobtrusive.js.

  • 0
    Да я в этом убедился

Ещё вопросы

Сообщество Overcoder
Наверх
Меню