dimanche 6 décembre 2015

I'm having trouble loading Modal and able to popup i am newbie in mvc

here it my code where i called from

 <div class="form-group form-inline">
      @Html.LabelFor(model => model.Supplier_ContactId, new { @class = "control-label col-md-2" })
      <div class="col-md-10">
      @Html.EditorFor(model => model.Supplier_Contact.Supp_Email, new { htmlAttributes = new { @class = "form-control" } })
      <a class="btn btn-default" data-toggle="modal" href="@Url.Action("ModelEdit", "SupplierContact", new { id = @Model.ID })"><span class="glyphicon glyphicon-edit"></span>&nbsp;Edit</a>
      @Html.ValidationMessageFor(model => model.Supplier_ContactId, "", new { @class = "text-danger" })
      </div>
</div>

here its my modal view

@model OnLineShoppingCart.Models.Supplier_Contact
@{
    ViewBag.Title = "Edit";
    Layout = null;
}

<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span>
                    <span class="sr-only">Close</span>
                </button>
            </div>

            <div class="modal-body">
                <div>
                    <hr />
                    <div class="form-group">
                        @Html.LabelFor(model => model.Supplier.Company_Name, htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.DisplayFor(model => model.Supplier.Company_Name, new { htmlAttributes = new { @class = "form-control" } })
                        </div>
                    </div>

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

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

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

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

                    <div class="form-group">
                        @Html.LabelFor(model => model.Supp_Web, htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @Html.EditorFor(model => model.Supp_Web, new { htmlAttributes = new { @class = "form-control" } })
                            @Html.ValidationMessageFor(model => model.Supp_Web, "", 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" />
                                @Html.ActionLink("To List", "Index", null, new { controller = "SupplierAddress", id = Model.Id }, new { @class = "btn btn-success " })
                            </div>
                        </div>*@

                </div>
            </div>

            <div class="modal-footer">
                @using (Html.BeginForm("Edit", "Cantact", FormMethod.Post, new { data_bind = "submit: editSupplier" }))
                {
                    @Html.AntiForgeryToken()
                    <div class="form-actions no-color text-center" data-bind="visible: !sending()">

                        <input type="submit" value="Save" class="btn btn-danger" />
                        <button type="button" class="btn btn-default"
                                data-dismiss="modal">
                            Close
                        </button>

                    </div>
                }
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->`enter code here`
@*</div>*@

The issue is when I this line of code Layout = null; I get a blank screen but if I don't I get a normal screen but not a modal window please help me I am new to MVC

Aucun commentaire:

Enregistrer un commentaire