Solved

MVC 4 HELP

Posted on 2014-01-28
2
383 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

828 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