ASP.NET MVC (weird) DropDownList

Creating a dropdownlist in razor is kind of odd.

The general syntax is like this:

@using (Html.BeginForm("Edit", "Robot", FormMethod.Post, new { id = "EditRobotForm", @class = "form-inline" }))
    <div class="form-group">

        <label for="RobotDdl" class="control-label left-label">Robot</label>

        @Html.DropDownListFor(model => model.RobotId, Model.Robots, new { id = "RobotDdl", @class = "form-control input-sm" })

    <button type="button" id="btnSave" class="btn btn-primary btn-sm"><Save</button>

Modularizing JavaScript Code

Global Namespace Pollution

All JavaScript codes can run inside Global Execution Context. This means that if we define variables and functions at the global level, then the other codes can access them, no matter if they are in different files.

REST is stateless

Web applications (over HTTP) are disconnected. This means that once the server sends data over the wire to the client it forgets about it. The client on the second call should remind the server of its state.


© 2019. All rights reserved.