?
Solved

MVC 4 HELP

Posted on 2014-01-28
2
Medium Priority
?
388 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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