C
C#11mo ago
🙈

✅ 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
Jimmacle
Jimmacle11mo ago
$details
MODiX
MODiX11mo ago
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)
🙈
🙈OP11mo ago
i jsut want to call the index method and pass a vairble into the parremeter in the index method @Jimmacle
Pobiega
Pobiega11mo ago
show your index action signature also, are these two actions on the same controller?
🙈
🙈OP11mo ago
what yes they are on the same controller
Pobiega
Pobiega11mo ago
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
🙈
🙈OP11mo ago
ok i am away form my computer unfrogntly i forced to go out ill try and explain it to you
Pobiega
Pobiega11mo ago
no I don't want an explanation, I want to see the method signature for your Index action in that controller.
🙈
🙈OP11mo ago
what the method singature
Pobiega
Pobiega11mo ago
the method "header" before the actual code in it
🙈
🙈OP11mo ago
Public async task<iactionresult> index(orderid) that the index one i want to call and pass into
Pobiega
Pobiega11mo ago
thats not valid code
🙈
🙈OP11mo ago
but its exactly like that
Pobiega
Pobiega11mo ago
no come back when you have your actual code we can't help based on what you think you wrote
🙈
🙈OP11mo ago
oh ok got it
Pobiega
Pobiega11mo ago
? $code
MODiX
MODiX11mo ago
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/
🙈
🙈OP11mo ago
one sec
Pobiega
Pobiega11mo ago
post your code here. orderId is not the same as orderid
🙈
🙈OP11mo ago
this code as a few typos
Pobiega
Pobiega11mo ago
they must be identical for the RedirectToAction to work
🙈
🙈OP11mo ago
but 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
Pobiega
Pobiega11mo ago
$code
MODiX
MODiX11mo ago
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/
Pobiega
Pobiega11mo ago
paste your FULL CODE there not a hand-written snippet full of typos
🙈
🙈OP11mo ago
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
Pobiega
Pobiega11mo ago
the property name must match the index argument name exactly down to the individual letters and casing
🙈
🙈OP11mo ago
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
Pobiega
Pobiega11mo ago
¯\_(ツ)_/¯ 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
🙈
🙈OP11mo ago
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
Pobiega
Pobiega11mo ago
If you're not going to answer my questions, I'm not interested in helping. Good luck.
🙈
🙈OP11mo ago
wait what no what was your question my bad i never read your question i will try and fix it asp thank you again
Want results from more Discord servers?
Add your server