Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
[HttpPost]
        public ActionResult Create(Inv_Invoice_Master inv)
        {
            if (ModelState.IsValid)
            {
                repository.Insert(inv);
                repository.Save();
            }
            ViewBag.CompanyId = new SelectList(entity.Company_InfoTbl, "CompanyId", "CompanyName", inv.CompanyId);
            ViewBag.Sale_Id = new SelectList(entity.Inv_Sells_Details, "Sale_Id", "Sells_Details",inv.Sale_Id);
            ViewBag.Payment_Id = new SelectList(entity.Inv_Payment_Master, "Payment_Id", "Payment_Type",inv.Payment_Id);
            ViewBag.Cust_ID = new SelectList(entity.Inv_Company_Customer, "Cust_ID", "Cust_Company_Name",inv.Cust_ID);
            ViewBag.CurrencyId = new SelectList(entity.Currency_Master, "CurrencyId", "Formal_Name", inv.CurrencyId);
            ViewBag.Tax_ID = new SelectList(entity.Inv_Tax_Master, "Tax_ID", "Business_Tax_Name",inv.Tax_ID);

            return RedirectToAction("Index");

        }
        [HttpGet]
        public ActionResult Edit(int? id)
    {
        if (id == null)
            return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        Inv_Invoice_Master vo = repository.SelectById(id);
        ViewBag.CompanyId = new SelectList(entity.Company_InfoTbl, "CompanyId", "CompanyName", vo.CompanyId);
        ViewBag.Sale_Id = new SelectList(entity.Inv_Sells_Details, "Sale_Id", "Sells_Details", vo.Sale_Id);
        ViewBag.Payment_Id = new SelectList(entity.Inv_Payment_Master, "Payment_Id", "Payment_Type",vo.Payment_Id);
        ViewBag.Cust_ID = new SelectList(entity.Inv_Company_Customer, "Cust_ID", "Cust_Company_Name",vo.Cust_ID);
        ViewBag.CurrencyId = new SelectList(entity.Currency_Master, "CurrencyId", "Formal_Name", vo.CurrencyId);
        ViewBag.Tax_ID = new SelectList(entity.Inv_Tax_Master, "Tax_ID", "Business_Tax_Name",vo.Tax_ID);

        return View(vo);
    }

I am using this scenario for drop down list but i want to fetch some such as owner name,adress and so on information by using companyId and save it to another as well can be shown on view in the grid view with dynamic fields.
Posted
Updated 18-Feb-15 18:24pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900