It’s a typo. Remove all the “NewPizza.”
'PizzaModel' does not contain a definition for 'NewPizza' and no accessible extension method 'NewPizza' accepting a first argument of type 'PizzaModel'
I have been following along this documentation
I didn't even change the any variable name still getting this error
Also I did not change any code either.
I am simply copy pasting it from documentation.
I cant understanding how could I get this errors although I am following the documentation of Microsoft!!!!!!
3 answers
Sort by: Oldest
-
-
Rena Ni - MSFT 2,061 Reputation points
2022-07-18T01:37:56.743+00:00 Hi @Mouhamed ,
Be sure add the property named
NewPizza
in yourPizzaModel
:public class PizzaModel : PageModel { public NewPizza NewPizza { get; set; } //be sure add this.... public void OnGet() { } }
Also be sure you have created the model:
public class NewPizza { public string Name { get; set; } public string Size { get; set; } public int Price{ get; set; } //..... }
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.Best Regards,
Rena -
Lynn Li 1 Reputation point
2022-11-09T09:59:19.463+00:00 you met this error message because you did not complete the following steps.
In following steps, you should have added "newpizza" to your PizzaModel class.