0
votes

I would like to pass parameter grid-page, but i get error while compiling

Error 2 Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.

return RedirectToAction("Grid", new { sukurta = item.lic_plate, grid-page = 2 });

1
Use grid_page. Identifiers can't contain a hyphen. - CodeCaster
A - is not a valid character for a variable name. - user247702
@Stijn Might as well post that as an answer since it's... the answer. - Ant P
@AntP I think the question should be closed as a typo instead. Feel free to post an answer though if think it should stay open, I don't mind :) - user247702
@Stijn I'm not so sure - in this instance it's a typo, but the same situation could easily arise as a genuine "what does this error mean," scenario, so it's probably worth keeping (with a better title). - Ant P

1 Answers

0
votes
Check this code
---------------
My simple suggestion is just remove '-' symbol
public ActionResult Index()
            {

                  return RedirectToAction("About" , new
                  {
                        sukurta = "a" ,
                        grid_page = "3"
                  });
            }

            public ActionResult About( string sukurta , string grid_page )
            {


                  return View();
            }