Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Neesmine funkcija bet cia del supratimo kokia naudoju jquery dialogine forma.
- function OpenContactAddressDialog() {
- var cntID = $("#txtCntID").val();
- if (cntID > 0) {
- var dialog = $("#dialog-area").dialog({
- dialogClass: "no-close",
- autoOpen: false,
- resizable: false,
- show: {
- effect: "blind",
- duration: 1000
- },
- hide: {
- effect: "explode",
- duration: 1000
- },
- height: 500,
- width: ($(window).width() - 50 < 400) ? ($(window).width() - 50) : (400),
- modal: true,
- buttons: [
- {
- text: "Close",
- click: function () {
- FormatContactAddress(cntID);
- $(this).dialog("close");
- }
- }
- ]
- });
- var loaded = LoadContactAddress(cntID);
- if (loaded) {
- dialog.dialog("open");
- } else
- {
- window.location.href = "/Home/Index";
- }
- }
- else {
- BootstrapDialog.alert("Please select a contact first!");
- }
- return false;
- }
- // is ajaxo perkraunu dar karta modaline forma
- $.ajax({
- cache: false,
- async: false,
- type: "GET",
- dataType: "html",
- url: "/ContactAddress/Index",
- data: { "ContactID": cntID },
- success: function (data) {
- $("#dialog-area").html(data);
- result =true;
- },
- error: function (xhr, ajaxOptions, thrownError) {
- alert('Could not retrieve Contact address!');
- result=false;
- }
- });
- //MVC .NET razor viewas:
- @Using Ajax.BeginForm("Edit", "ContactAddress", New AjaxOptions With {.HttpMethod = "POST", .OnSuccess = "OnAddressSuccess", .OnFailure = "OnAddressFailure"})
- @Html.AntiForgeryToken()
- @<div class="row">
- <div Class="col-md-12">
- @Html.Label("Country")
- @Html.DropDownList("CountryList", Nothing, "- Select Country -", New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div Class="col-md-12">
- @Html.Label("Type")
- @Html.DropDownList("ContactAddrTypeList", Nothing, "- Select Type -", New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Is Main")<br />
- @Html.CheckBox("ckbMain", If(IsNothing(Model), True, If(Model.cnaIsMain = "Y", True, False)))
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Address 1")
- @Html.TextBox("txtAddress1", If(IsNothing(Model), String.Empty, Model.cnaAddr1), New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Address 2")
- @Html.TextBox("txtAddress2", If(IsNothing(Model), String.Empty, Model.cnaAddr2), New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Town")
- @Html.TextBox("txtTown", If(IsNothing(Model), String.Empty, Model.cnaTown), New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Region")
- @Html.TextBox("txtRegion", If(IsNothing(Model), String.Empty, Model.cnaRegion), New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div Class="col-md-12">
- @Html.Label("Post Code")
- @Html.TextBox("txtPostCode", If(IsNothing(Model), String.Empty, Model.cnaPostCode), New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Salut")
- @Html.TextBox("txtSalut", If(IsNothing(Model), String.Empty, Model.cnaSalut), New With {.class = "form-control"})
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Is Active")<br />
- @Html.CheckBox("ckbActive", If(IsNothing(Model), True, If(Model.cnaActive = "Y", True, False)))
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Label("Is Post Code First")<br />
- @Html.CheckBox("ckbPCodeF", If(IsNothing(Model), True, If(Model.cnaPCodeF = "Y", True, False)))
- </div>
- </div>
- @<div class="row">
- <div class="col-md-12">
- @Html.Hidden("txtCnaID", If(IsNothing(Model), String.Empty, Model.cnaID), New With {.id = "txtCnaID"})
- @Html.Hidden("txtCntID", If(IsNothing(Model), String.Empty, Model.cna_cntID), New With {.id = "txtCntID"})
- </div>
- </div>
- @<input type="submit" value="Save" class="btn btn-primary" />
- End Using
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement