![]() |
|
[C#.NET] مشكلة في حفظ بيانات cascading - نسخة قابلة للطباعة +- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb) +-- قسم : قسم برمجة وتطوير المواقع (http://vb4arb.com/vb/forumdisplay.php?fid=51) +--- قسم : قسم ASP.NET (http://vb4arb.com/vb/forumdisplay.php?fid=52) +---- قسم : قسم اسئلة ASP.NET (http://vb4arb.com/vb/forumdisplay.php?fid=53) +---- الموضوع : [C#.NET] مشكلة في حفظ بيانات cascading (/showthread.php?tid=18019) |
مشكلة في حفظ بيانات cascading - dmw2200 - 14-11-16 عندي مشكلة وهي إني كلما أحاول أن أدخل بيانات الدولة والمحافظة والمدينة تدخل فقط بيانات الدولة أما الباقي تصبح فارغة طبعا أنا استخدمت cascading كيف أجعل جميع البيانات تضاف في الجدول ولكم جزيل الشكر هذا كود html في الصفحة طبعا يعمل create item ويضعها في جدول item وهذه البيانات التي لم تدخل معي عدا الدولة فقط هي التي تعمل كود : <!--Country-->>وهذا كود jquery كود : <script>وهذه دالة الحفظ في controller اسمه item [HttpGet] public ActionResult Create() { List<Category> catlist = db.Categories.ToList(); SelectList sl = new SelectList(catlist.AsEnumerable(), "id", "name"); ViewBag.SelectCategories = sl; List<Country> countrylist = db.CountryTb.ToList(); SelectList s2 = new SelectList(countrylist.AsEnumerable(), "id", "name"); ViewBag.SelectCountry = s2; return View(); } [HttpPost] public ActionResult Create(Item i) { db.Items.Add(i); db.SaveChanges(); return RedirectToAction("Index"); } وهذا JsonResult طبعا موجود في كنترول آخر تحت اسم country public JsonResult GetStatesById(int ID) { db.Configuration.ProxyCreationEnabled = false; return Json(db.StatesTb.Where(p => p.country_id == ID), JsonRequestBehavior.AllowGet); } public JsonResult GetCitiesById(int ID) { db.Configuration.ProxyCreationEnabled = false; return Json(db.CityTb.Where(p => p.state_id == ID), JsonRequestBehavior.AllowGet); } |