Posts

search bar in mvc

Index.cshtml  CODE     <input type="text" id="prodId" size="7" />     <button class="btn btn-info my-2 my-sm-0" caption="search" id="search-now"> Search</button>     <div id="search-results"> </div> put that on your page want your search bar to display. the div id search results are where you want your search results to display. In your views folder, create a Search Folder . add item Razor View named _SearchRestults.cshtml (this is a partial) CODE     @model LegoListViewModel     <div class="row">     @foreach (var lego in Model.Legos)     {             <div class="col-md-4">             <figure><a href=" @lego.URL " target="_blank"><img src=" @lego.Images " />                           ...

Ruby Hashes Intermediate

Image
from https://www.learnruby.today/section-two/hashes.html Ruby Hashes - Intermediate The hash is a dictionary-like collection that stores unique keys and their values. It is sometimes referred to as a dictionary or associative array in other programming languages. They are similar to arrays in that both are indexed collections of object references. The difference is that arrays are integer indexed while hashes are object indexed. The index can be an object of any type (string, regular expression, and so on) and is usually referred to as the  key . The key can then be used to access the value. Creating a hash A hash can be easily created using its implicit form: >> contact = { "first_name" => "Frederick" } { "first_name" => "Frederick" } Reading the example out loud we have, "the variable contact references a hash with a key of "first_name" which yields, or results in, "Frederick". Notice th...