Solved

MVC 4 HELP

Posted on 2014-01-28
2
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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