✅ return RedirectToAction("Index", new { orderId = ordervar });why dose this only show new orderhow
help pls return RedirectToAction("Index", new { orderId = ordervar });
why dose this only show new order
how to i call the index method and pass in orderid so it shows all orders
32 Replies
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
i jsut want to call the index method and pass a vairble into the parremeter in the index method
@Jimmacle
show your index action signature
also, are these two actions on the same controller?
what
yes they are on the same controller
show your index action signature
or just the code for that entire controller I guess
we can't really help unless you show your code
ok
i am away form my computer
unfrogntly i forced to go out
ill try and explain it to you
no
I don't want an explanation, I want to see the method signature for your
Index
action in that controller.what the method singature
the method "header" before the actual code in it
Public async task<iactionresult> index(orderid)
that the index one i want to call and pass into
thats not valid code
but its exactly like that
no
come back when you have your actual code
we can't help based on what you think you wrote
oh ok
got it
?
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/one sec
post your code here.
orderId
is not the same as orderid
this code as a few typos
they must be identical for the
RedirectToAction
to workbut the real one is fixed
oh when calling it
you see it is working it is returing to index method but only showing the order that was jsut created because of RedirectToAction("Index", new { orderId = ordervar });why dose this only show new orderhow. I want it to show all orders where OrderId == ordervar the varible passed into the method
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/paste your FULL CODE there
not a hand-written snippet full of typos
i cant that all i have right now i will send you it asp
so this code shoudl work RedirectToAction("Index", new { orderId = ordervar });
but its the order code that is messing it up
the property name must match the index argument name exactly
down to the individual letters and casing
ok and would that show all the records
i dont get what new means
will that show all records in the idnex page where the order ids match
¯\_(ツ)_/¯
You wrote your own code.
thats for you to answer, not me
when you do the redirect, does the new URL contain the expected id?
if it does, your problem is the index code itself, not the redirect
learn how to break your problem down and tackle it one step at a time
the only probelm is this line RedirectToAction("Index", new { orderId = ordervar });
the rest of the code works
if i had to ask you how would you rediritct action to the index method and pass a varible into it how woudl you do it
If you're not going to answer my questions, I'm not interested in helping. Good luck.
wait what no what was your question
my bad i never read your question i will try and fix it asp thank you again