I'm working on a Asp.net Razor application. I have a table on my page, and have some names of people as the y_axis for this table.
I have incorporated a tool tip (Tooltipster library) for these names. I would like to display information about these people in the tool tip, info such as their telephone number, city and ID.
This information lies in my database Model. I also have a ViewModel, to retrieve the information as well.
I was wondering how I would retrieve the information and place it in the title attribute that the names/y_axis is located (the information must go in the title for the tool tip to function correctly).
My script:
var engName = document.getElementsByClassName("dhx_matrix_scell");
for (var i = 0; i < engName.length; i++) {
engName[i].className = engName[i].className + " tooltipss";
engName[i].title = _______________________________
}
ViewModel:
public class W6ViewModel
{
public virtual ICollection<W6ENGINEERS> engineers { get; set; }
}
Controller for the index:
viewModel.engineers = db.W6ENGINEERS.OrderBy(w => w.Name).ToList();
What I tried so far, but get errors
var engName = document.getElementsByClassName("dhx_matrix_scell");
var name = engName.innerHTML();
for (var i = 0; i < engName.length; i++) {
@{
//get error here since name isn't visible to the Model
var engineer = Model.engineers.Where(v => v.Name = name);
}
engName[i].className = engName[i].className + " tooltipss";
engName[i].title = engineer.telephone;
}
Thanks for all your help in advance