Click here to Skip to main content
15,893,190 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
//this is the action I want to redirect to, how can I do it   
  public ActionResult StoreOrderHistory(int? page, int storeID, int? month)
   {

   }

public ActionResult Edit(OrderInfo objOrderInfo)
{
  return RedirectoToAction();
}
Posted
Updated 3-Nov-15 0:28am
v3

Create one action link like this,
HTML
@Url.Action("Edit", "ControllerName", new { page = 1})


As you've having overridden methods, you need to attribute the, as HttpGet/HttpPost.
You're HttpGet method should return some View, which in your case it is blank.

[Update after a comment]
Oh! You meant that. That wasn't in your question.
Anyway, use return RedirectToAction("Edit", new { page = 1, storeID = 0})


-KR
 
Share this answer
 
v2
Comments
MayankSemwal 3-Nov-15 6:19am    
How can I use Url.Action() in controller
Krunal Rohit 3-Nov-15 6:22am    
Oh! You meant that. That wasn't in your question.
Anyway, use return RedirectToAction("Edit", new { page = 1, storeID = 0})

-KR
MayankSemwal 3-Nov-15 6:28am    
I have updated question, can you tell in that. same i tried for this, throwing error
Krunal Rohit 3-Nov-15 6:39am    
return RedirectToAction("Edit", new { page = 1, storeID = 0, month = 1});


-KR
Krunal Rohit 3-Nov-15 6:40am    
And what's error ?

-KR
SQL
Hi ,

You can pass parameters in second parameters of a RedirectToAction method [ object rout values]

return RedirectToAction("Index", new { parameters });
 
Share this answer
 
Comments
MayankSemwal 3-Nov-15 6:19am    
sanjay@ Yes I can Pass, but how can I pass pagination
You can try
C#
public ActionResult StoreOrderHistory(int? page, int storeID, int? month)
   {
 
   }

public ActionResult Edit(OrderInfo objOrderInfo)
{
     if (ModelState.IsValid)
     {
         return RedirectToAction("StoreOrderHistory", new {
               page = 5,
               storeID= 5432,
               month= 1
           });
     }
     return view(Model);
}
 
Share this answer
 
v2
Comments
MayankSemwal 3-Nov-15 6:29am    
@PANKAJMAURYA , In Updated question same thing i tried its throwing error
[no name] 3-Nov-15 6:34am    
Please try now. still getting error please post full error message and stack trace.
MayankSemwal 3-Nov-15 6:35am    
The resource cannot be found.HTTP 404.
MayankSemwal 3-Nov-15 7:03am    
I was not Getting right storeID because i didn't mapped it right. Worked now. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900