I have found the solution to this problem.. the problem is when i pass the viewbage value to my partial view it works fine but when i select the ddl value and trying to submit into database it does not recognize which value of ddl is selected so i need to use "P_CategoryID" as DDL id which is my "product" class property instead of viewbag reserve keyword "Category"
here is my controller that populate the DDL:
public ActionResult CreateProductsByAjaxCall()
{
ViewBag.P_CatedoryID = new SelectList(db.GetALLCategoriesForProducts(), "Cat_ID", "Cat_Name");
return PartialView();
}
by changing the id of dropdown list from "Category" to "P_CatedoryID"
@Html.DropDownList("Category", (SelectList)ViewBag.RequiredKey, new { @class = "form-control" })
Now my view code looks like
@Html.DropDownList("P_CatedoryID", (SelectList)ViewBag.RequiredKey, new { @class = "form-control" })