how to get the value of a dictionary from the key in unity code example
Example 1: How to set the value to be selected in the dropdownlist in mvc
BY LOVE
• Here , Model is a dynamic object and from that modal we are fetching States property which is of list type.
• Here , employee is an employee object and from that object we are fetching state property of that particular employee.
@foreach (var S in Model.States)
{
if (S.StateName == employee.State)
{
<option value="@S.StateName" selected="selected">@S.StateName</option>
}
else
{
<option value="@S.StateName">@S.StateName</option>
}
}
Example 2: how to get the value in a tag in react
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick = (event) => {
alert(event.target.innerText);
alert(event.target.tagName);
}
render() {
return (
<div>
<div className="text-center">
<button className="btn btn-secondary" onClick={this.handleClick}>
Click Me
</button>
</div>
</div>
);
}
}
export default App;