MVC 5 textboxfor update

MVC 5 textboxfor update
2018-08-23T19:05:34+02:00
2018-08-24T09:19:57+02:00
2022-12-05T13:25:40+01:00
Iati1980
Sziasztok!

Abban kérném a segítségeteket, hogy miképp lehetne megoldani az alábbi kódban, hogy az irányítószám megadásakor kiírja a települést anélkül, hogy az egész oldalt újratöltse.



<h2>@ViewBag.Title</h2>
<div class="row">
    <div class="col-md-8">
        <section id="loginForm">
            @using (Html.BeginForm("Company", "Admin", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
            {
                @Html.AntiForgeryToken()
                <h4></h4>
                <hr />
                @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Cegnev, new { @class = "form-control", @placeholder = "Cég neve" })
                        @Html.ValidationMessageFor(m => m.Cegnev, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Webaruhaznev, new { @class = "form-control", @placeholder = "Webáruház neve" })
                        @Html.ValidationMessageFor(m => m.Webaruhaznev, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Adoszam, new { @class = "form-control", placeholder = "Adószám" })
                        @Html.ValidationMessageFor(m => m.Adoszam, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Bankneve, new { @class = "form-control", placeholder = "Bank neve" })
                        @Html.ValidationMessageFor(m => m.Bankneve, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Szamlaszam, new { @class = "form-control", placeholder = "Számlaszám" })
                        @Html.ValidationMessageFor(m => m.Szamlaszam, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Cegjegyzekszam, new { @class = "form-control", placeholder = "Cégjegyzékszám" })
                        @Html.ValidationMessageFor(m => m.Cegjegyzekszam, "", new { @class = "text-danger" })
                    </div>
                </div>
                <hr />
                <h4>Számlázási cím</h4>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.DropDownListFor(model => model.Szamorszag, ViewBag.SzamorszagList as SelectList, "-------", new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Szamorszag, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Szamirszam, new { @class = "form-control", placeholder = "Irányítószám" })
                        @Html.ValidationMessageFor(m => m.Szamirszam, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Szamtelep, new { @class = "form-control", placeholder = "Település", @Value = ViewBag.Szamtelep })
                        @Html.ValidationMessageFor(m => m.Szamtelep, "", new { @class = "text-danger" })
                    </div>
                </div>
                    <div class="form-group">
                        <div class="col-md-10">
                            @Html.TextBoxFor(m => m.Szamcim, new { @class = "form-control", placeholder = "Cím" })
                            @Html.ValidationMessageFor(m => m.Szamcim, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <hr />
                    <h4>Levelezési cím</h4>
                    <div class="form-group">
                        <div class="col-md-10">
                            @Html.DropDownListFor(model => model.Szalorszag, ViewBag.SzalorszagList as SelectList, "-------", new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Szalorszag, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-10">
                            @Html.TextBoxFor(m => m.Szalirszam, new { onchange = "this.form.submit()", @class = "form-control", placeholder = "Irányítószám" })
                            @Html.ValidationMessageFor(m => m.Szalirszam, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-10">
                            @Html.TextBoxFor(m => m.Szaltelepules, new { @class = "form-control", placeholder = "Település", @Value = ViewBag.Szaltelep })
                            @Html.ValidationMessageFor(m => m.Szaltelepules, "", new { @class = "text-danger" })
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-10">
                            @Html.TextBoxFor(m => m.Szalcim, new { @class = "form-control", placeholder = "Cím" })
                            @Html.ValidationMessageFor(m => m.Szalcim, "", new { @class = "text-danger" })
      &nb
Mutasd a teljes hozzászólást!
Javascript/AJAX használatával.
Mutasd a teljes hozzászólást!

Tetszett amit olvastál? Szeretnél a jövőben is értesülni a hasonló érdekességekről?
abcd