Good day. This must be a very basic thing to do, though I didn't manage to find any information on it.
I have a treeview setup like this:
.DataSource(dataSource => dataSource.Read(read => read.Action("GetView", "Tree"))
My controller looks like this:
TreeController : Controller
_repository = repository;
var items = _repository.GetItems();
var viewmodel = items.Select(t =>
id = t.Id,
Text = t.Text,
hasChildren = t.HasChildren
That part works just fine.
Now, I would like to add a button that would, say, rename the selected item. So,I know how to get the selected item in the treeview. What I do not know how to implement is the connection viewmodel -> data model. That is, knowing the selected html item I have no idea how to get the model item it coresponds to. That would be solvable if I could add my custom html "model-id" property on every item and pass it back to controller on my button click. Which I have no idea how to implement either.
Thank you in advance.