با سلام خدمت استاد مدائنی
من طبق اموزش که پیش رفتم اون کسکید دراپ دون هایی که برای گروه و زیر گروه ها انتخاب میکنم کار نمیکنن داده ها پر میشند اما وقتی گروه اصلی رو تغییر میدم زیر گروه های اون گروه تغییر نمیکنند و در ضمن من ادمین رو با همون ام وی سی پیش بردم نه با ریزور پیج
کد صفحه
@using MiladJahanbin.Web.Models.ProjectsModel
@model Project
@{
    ViewData["Title"] = "CreateProject";
}
<div style="margin-top :100px" class="container">
    <form method="post" enctype="multipart/form-data">
        <div class="col-md-12">
            <h2>اطلاعات پروژه</h2>
            <hr />
            <div class="form-group">
                <label>عنوان پروژه</label>
                <input type="text" asp-for="ProjectTitle" class="form-control">
                <span asp-validation-for="ProjectTitle"></span>
            </div>
            <div class="form-group">
                <label>گروه اصلی</label>
                <select class="form-control" asp-for="GroupId" id="MainGroup" name="MainGroup" asp-items="ViewBag.MainGroup"></select>
                <span asp-validation-for="GroupId"></span>
            </div>
            <div class="form-group">
                <label>گروه فرعی</label>
                <select class="form-control" asp-for="SubGroup" id="SubGroup" name="SubGroup" asp-items="ViewBag.SubGroup"></select>
                <span asp-validation-for="SubGroup"></span>
            </div>
            <div class="form-group">
                <label>نویسنده پروژه</label>
                <select class="form-control" asp-for="WriterId" asp-items="@(ViewData["Writer"] as SelectList)"></select>
                <span asp-validation-for="WriterId"></span>
            </div>
            <div class="form-group">
                <label>شرح پروژه</label>
                <textarea class="form-control" asp-for="ProjectDescription" rows="10"></textarea>
                <span asp-validation-for="ProjectDescription"></span>
            </div>
            <div class="form-group">
                <label>کلمات کلیدی</label>
                <input type="text" asp-for="Tags" value="0" class="form-control" />
                <br />
                <p class="help-block">کلمات را با - جدا کنید</p>
            </div>
            <div class="form-group">
                <label>فایل ویدئوی پروژه</label>
                <input type="file" name="videoUp">
                <span asp-validation-for="VideoFileName"></span>
            </div>
            <hr />
            <img id="imgProject" class="thumbnail" src="/img/gallery/project-1.jpg" asp-append-version="true" />
            <div class="form-group">
                <label>انتخاب تصویر</label>
                <br />
                <input type="file" name="imgProjectUp" id="imgProjectUp">
            </div>
            <input type="submit" value="ذخیره اطلاعات" class="btn btn-success" />
        </div>
    </form>
</div>
@section Scripts
{
    <script>
             $("#MainGroup").change(function() {
            $("#SubGroup").empty();
            $.getJSON("/AdminPanel/Admin/GetSubGroups/" + $("#MainGroup :selected").val(),
                function(data) {
                    $.each(data,
                        function() {
                            $("#SubGroup").append('<option value=' + this.value + '>' + this.text + '</option>');
                        });
                });
        });
        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    $('#imgProject').attr('src', e.target.result);
                }
                reader.readAsDataURL(input.files[0]);
            }
        }
        $("#imgProjectUp").change(function () {
            readURL(this);
        });
    </script>
}
کد سرویس
public List<SelectListItem> GetGroupForManageProject()
{
    return _context.ProjectGroups.Where(g => g.ParentId == null)
        .Select(g => new SelectListItem()
        {
            Text = g.GroupTitle,
            Value = g.GroupId.ToString()
        }).ToList();
}
public List<SelectListItem> GetSubGroupForManageProject(int groupId)
{
    return _context.ProjectGroups.Where(g => g.ParentId == groupId)
        .Select(g => new SelectListItem()
        {
            Text = g.GroupTitle,
            Value = g.GroupId.ToString()
        }).ToList();کد کنترلر
public IActionResult GetSubGroups(int id)
{
    List<SelectListItem> list = new List<SelectListItem>()
    {
        new SelectListItem(){Text="انتخاب کنید",Value=""}
    };
    list.AddRange(_projectService.GetSubGroupForManageProject(id));
    return Json(list);
}سلام
نمونه دوره را بررسی میکنم ، اگر مشکل داشت سریع رفع و اطلاع رسانی میکنم .
سلام استاد وقت بخیر
میخواستم بدونم که سورس رو برسی کردید؟
بله بررسی کردم نمونه دوره بدون هیچ میشکلی داره کار میکنه
کدها تون را trace کنید تا مشکل پیدا بشه