Answer the question
In order to leave comments, you need to log in
How to populate a List in an html page?
The model has an empty List, which, after filling, must be written to the DB.
That is, the user must manually write the values for the list, as much as he wants. So far, it only occurred to me to apply string split with string values separated by commas.
Maybe there is a way to make it prettier? For example, the user entered a word, clicked ok, a new field appeared that the user can fill in, or something else.
What is the trick to do this in html?
I will be glad for any help. Thank you!
Answer the question
In order to leave comments, you need to log in
You can either send this empty sheet for submission, or send it already filled out, for example, by clicking the save button.
To implement these actions, for example, I use:
1. Static library vue.js. To render the received data.
2. Axios. For requests to the server to get data.
3. Json data format.
In fact, it turns out like this. You go to the page. At this point, vue has a method that fires when the page loads.
mounted(){
axios.post("/Home/GetList", null).then(resp =>{
this.list = resp.data;
});
}
public JsonResult GetList(){
var res = db.TableList.GetAll();
return Json(res);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question