Solved

MVC 4 HELP

Posted on 2014-01-28
2
382 Views
Last Modified: 2014-01-29
I have a view that looks like EditSupplier.jpg.  When the user clicks Order By PO, they will get the screen OrderByPO.jpg.  When the user clicks Resend Back Load, I am running a stored proc that returns no records.  After the stored proc returns, I want to return to the OrderByPO.jpg screen in case the user wants to order another backload.

How do I do that.  

Controller:

 public ActionResult ResendBackLoad(int id)
        {
            try
            {

                ExpireSupplier obj = new ExpireSupplier();
                obj.ResendBackLoad(id);
             
                return View();  -  This throws an error
            }
            catch
            {
                return View();
            }
        }


Model

 public int ResendBackLoad(int id)
        {


            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SchoolContext"].ConnectionString);

            SqlCommand sqlComm = new SqlCommand("spRTBackloadByPO", con);
            sqlComm.CommandType = CommandType.StoredProcedure;
            sqlComm.Parameters.AddWithValue("@PONumber", id);
           
            con.Open();
            sqlComm.ExecuteNonQuery();
           
            con.Close();

            return 1;


        }


View:  ????
I am trying to return to the OrderByPO.jpg view, but I don't know how to get back to it.

Can someone please help.  Thanks.
orderbypo.jpg
EditSupplier.jpg
0
Comment
Question by:sherbug1015
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39817188
Instead of just return View(); you want:
return RedirectToAction("actionName", "controllerName");

Open in new window

Replacing actionName and controllerName with values relevant to you code. If the Action is in the same controller as your ResendBackLoad method then you can omit the controllerName parameter.
0
 

Author Closing Comment

by:sherbug1015
ID: 39817575
Perfect, thank you
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question