Note that there are some explanatory texts on larger screens.

plurals
  1. POClear values at refresh in asp.net mvc 4
    primarykey
    data
    text
    <p>When i click submit button all values will saved on database,and the text box fields get cleared, when i use refresh the submit action will repeat and it will stores already exiting same values.How to solve this problem....</p> <p>My code is</p> <pre><code> [HttpPost] public ActionResult ReceiptMaster(Receipt model, string command) { Receipt Receipt = new Models.Receipt(); ViewData["RE"] = model.Recepit_NO; ViewData["PAYMODE"] = model.Pay_Mode; ViewData["Credit"] = model.Credited; ViewData["CustName"] = model.Cust_Name; ViewData["Cust_ID"] = model.Cust_Id; if (command == "Sumbit") { int Id = 0; if (model.Pay_Mode == "C") { model.ChequeNo = ""; model.Cheque_Date = ("1/1/1753 12:00:00 AM"); model.Bank_Name = ""; model.Bank_Address = ""; } if (ModelState.IsValid) { Id = Receipt.SaveReceipt(model.Id, model.Cust_Id, model.Pay_Amount, model.Pay_Mode, model.Bank_Name, model.Bank_Address, model.ChequeNo, model.Cheque_Date, model.Credited, model.Recepit_NO); if (Id &gt; 0) { /*RECEPIT NUMBER INCREMENT*/ string y = model.Recepit_NO; int i = Convert.ToInt32(y.Substring(2)); i = i + 1; string re = "RE" + i; model.Recepit_NO = re; ViewData["RE"] = re; /*END RECEPIT NUMBER*/ ViewData["Success"] = "Product was saved successfully."; ViewData["ControlView"] = 1; ViewData["Success"] = "Product was saved successfully."; ViewData["ControlView"] = 1; ViewData["Cust_ID"] = ""; ViewData["Pay_mode"] = "C"; ViewData["Pay_Amount"] = ""; model.Pay_Amount= ""; model.Cheque_Date = ""; model.ChequeNo = ""; model.Bank_Name = ""; model.Bank_Address = ""; //ObservableCollection&lt;Receipt&gt; ReceiptList = new ObservableCollection&lt;Receipt&gt;(); model.ReceiptList = Receipt.GetReceiptList();// model.ReceiptList is your model property ViewData["Count"] = model.ReceiptList.Count; return View(model.ReceiptList); } </code></pre> <p>Thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload