Create a Controller A & B
public class BController : Controller
{
// GET: B
public ActionResult Index()
{
List<B> objlist = new List<B>();
B objB = new B();
objB.EmpID = 5;
objB.EmpName = "Ramkee Gurrala";
objB.Companyname = "Avent IT Solution";
objlist.Add(objB);
objB.ListEmpB = objlist;
return View(objB);
}
}
public class AController : Controller
{
// GET: A
public ActionResult Index()
{
List<A> objlist = new List<A>();
A objA = new A();
objA.PersonAid = 523;
objA.PaersonAname = "Rajakonda Ashok";
objA.PersonAage = 0;
objlist.Add(objA);
objA.ListPersonA = objlist;
return View(objA);
}
}
Partial Controller.cs
public class PartialController : Controller
{
// GET: Partial
public ActionResult Index()
{
List<Partial> objlistcar = new List<Partial>();
Partial objcar = new Partial();
objcar.CarID = 1;
objcar.CarColor = "Rajakonda Uday";
objcar.CarPrice = 20000;
objcar.CarType = "sporty";
objlistcar.Add(objcar);
// add item in lists
Partial objcar1 = new Partial();
objcar1.CarID = 2;
objcar1.CarColor = "Rajakonda Devaansh";
objcar1.CarPrice = 20000;
objcar1.CarType = "Snajsb";
objlistcar.Add(objcar1); // add item in list
objcar.Listcar = objlistcar; // assigning value to CarModel object
return View(objcar);
return View();
}
Output:
public class BController : Controller
{
// GET: B
public ActionResult Index()
{
List<B> objlist = new List<B>();
B objB = new B();
objB.EmpID = 5;
objB.EmpName = "Ramkee Gurrala";
objB.Companyname = "Avent IT Solution";
objlist.Add(objB);
objB.ListEmpB = objlist;
return View(objB);
}
}
public class AController : Controller
{
// GET: A
public ActionResult Index()
{
List<A> objlist = new List<A>();
A objA = new A();
objA.PersonAid = 523;
objA.PaersonAname = "Rajakonda Ashok";
objA.PersonAage = 0;
objlist.Add(objA);
objA.ListPersonA = objlist;
return View(objA);
}
}
Partial Controller.cs
public class PartialController : Controller
{
// GET: Partial
public ActionResult Index()
{
List<Partial> objlistcar = new List<Partial>();
Partial objcar = new Partial();
objcar.CarID = 1;
objcar.CarColor = "Rajakonda Uday";
objcar.CarPrice = 20000;
objcar.CarType = "sporty";
objlistcar.Add(objcar);
// add item in lists
Partial objcar1 = new Partial();
objcar1.CarID = 2;
objcar1.CarColor = "Rajakonda Devaansh";
objcar1.CarPrice = 20000;
objcar1.CarType = "Snajsb";
objlistcar.Add(objcar1); // add item in list
objcar.Listcar = objlistcar; // assigning value to CarModel object
return View(objcar);
return View();
}
No comments:
Post a Comment
Thank you for visiting my blog