Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am new to ASP.NET Core MVC,
I created a ViewComponent that have a dropdownlist and records. I want to when selected index changing of dropdownlist then changing to records. How can i do this? Thanks.

What I have tried:

@model DemirHaberCore.ViewModels.InsaatDemiriViewModel
 
<div class="col-md-2">
    <h4>İnşaat Demiri</h4>
    <div class="form-group">
        @using (Html.BeginForm("InsaatDemiriKaydet", "Yonetim", FormMethod.Post))
        {
            @Html.DropDownListFor(m => m.insaat_Demiri.BolgeId,
           new SelectList(Model.Bolgeler.ToList(), "Id", "Ad"), new
                {
                    @class = "form-control",
            @onchange = "SelectedIndexChanged()" //<----What should i write here and to method?
                }) 
            @Html.LabelFor(m => m.insaat_Demiri.Kalin)
            @Html.TextBoxFor(m => m.insaat_Demiri.Kalin, new { @class = "form-control" })
            @Html.LabelFor(m => m.insaat_Demiri.Ince)
            @Html.TextBoxFor(m => m.insaat_Demiri.Ince, new { @class = "form-control" })
            @Html.HiddenFor(m => m.insaat_Demiri.BolgeId)
            <div><p class="form-control-static"</p> <button type="submit" class="btn btn-primary ">Kaydet</button></div>
        }
    </div>
</div> 
Posted
Updated 28-Mar-21 5:27am
v2
Comments
GSThakur 29-Mar-21 5:26am    
Since you know about event, have some implementation with googling and improvising would be easy.

Question seems to be more of "user story" implementation :)
You need to elaborate the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900