You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In /Controller/Models/Transaction.cs, this code below could make drop-down list of Category breaks if you don't choose any category. I know we can set range in the Transaction Model, but it is still a choice to choose.
Is there any way to improve that from AddOrEdit.cshtml side? cuz I know you remain CategoryId=0 for new category However, you insert a new CategoryId=0 in the model which makes it become a choice to choose.
[NonAction]publicvoidPopulateCategories(){varCategoryCollection=_context.Categories.ToList();CategoryDefaultCategory=newCategory(){CategoryId=0,Title="Choose a Category"};CategoryCollection.Insert(0,DefaultCategory);ViewBag.Categories=CategoryCollection;}
Origin display:
Expected display (default is CategoryId=1, and won't insert a CategoryId=0):
Thank you.
The text was updated successfully, but these errors were encountered:
Hi,
In
/Controller/Models/Transaction.cs
, this code below could make drop-down list of Category breaks if you don't choose any category. I know we can set range in the Transaction Model, but it is still a choice to choose.Is there any way to improve that from AddOrEdit.cshtml side? cuz I know you remain CategoryId=0 for
new category
However, you insert a new CategoryId=0 in the model which makes it become a choice to choose.Origin display:

Expected display (default is CategoryId=1, and won't insert a CategoryId=0):

Thank you.
The text was updated successfully, but these errors were encountered: