//ERROR
There is no ViewData item of type 'IEnumerable' that has the key 'ProductID'.
- [HttpGet
- public bool SelectProduct(clproduct clproduct)
- {
- using (MySqlConnection con = new MySqlConnection())
- {
- con.ConnectionString = constr;
- using (MySqlCommand cmd = new MySqlCommand())
- {
- cmd.Connection = con;
- cmd.CommandText = "insert into clientproduct (ProductId,ClientProductDetail,Act_Date,Exp_Date,CLProductId,ParentProductId) values ('" + clproduct.ProductId + "','" + clproduct.ClientProductDetail + "',"
- + "'" + clproduct.Act_Date + "','" + clproduct.Exp_Date + "','" + clproduct.CLProductId + "','" + clproduct.ParentProductId + "')";
- con.Open();
- i = cmd.ExecuteNonQuery();
- con.Close();
- return true;
- }
- return false;
- }
- }
- ]
- public ActionResult SelectedProduct()
- {
- MySqlConnection con = new MySqlConnection(constr);
- MySqlDataAdapter da = new MySqlDataAdapter("SELECT ProductId,ProductName,Description FROM ProductMaster", con);
- DataTable dt = new DataTable();
- da.Fill(dt);
- ViewBag.ProductNM = ToSelectList(dt, "ProductID", "ProductName");
- ViewBag.productid = ToSelectList(dt, "ProductId", "ProductId");
- ViewBag.desc = ToSelectList(dt, "ProductId", "Description");
- return View();
- }
- [HttpPost]
- public ActionResult SelectedProduct( clproduct cl)
- {
- string msg;
- if (ModelState.IsValid)
- {
- ModelState.Clear();
- try
- {
- if(i > 1)
- {
- SelectProduct(cl);
- Response.Write("
- *@
- @* *@
Nanddeep NachanPosted Aug 1, 2018, 2:04 AM
Nanddeep NachanPosted Aug 1, 2018, 4:21 AM
Ruchi SharavatPosted Aug 1, 2018, 3:16 AM
Guest UserPosted Aug 1, 2018, 2:47 AM
Ruchi SharavatPosted Aug 1, 2018, 2:42 AM
Guest UserPosted Aug 1, 2018, 2:36 AM
Nanddeep NachanPosted Aug 1, 2018, 2:18 AM
Ruchi SharavatPosted Aug 1, 2018, 2:17 AM