Solved

MVC 4 HELP

Posted on 2014-01-28
2
378 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
Comment Utility
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
Comment Utility
Perfect, thank you
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now