C-sharp code for the UI design elements

With the help of Visual Studio, developers were able to drag and drop UI elements in their designer. Visual Studio  auto generate C#(sharp) or VB.NET code for the UI design elements. This code is termed as “Back-end Code” or “Code Behind”. with the help of this  code developers can go and write logic to manipulate the UI elements.

Lets understand that why ASP.NET MVC was much faster in performance. Consider the below simple UI code behind that UI.

Suppose that ASPX code has simple text box like below.

<asp:TextBox ID=”TextBox1″ runat=”server”>

In this code you have written some logic which assign the text box values and the background colour.

protected void Page_Load(object sender, EventArgs e)
{           TextBox1.Text = “Make it simple”;
            TextBox1.BackColor = Color.Aqua;                           }

After running the above program below is the output screenshot of HTML.

lab_1.6

Check the HTML output of the above by opening View Source window and that will look something as shown below.

<input name=”TextBox1″ type=”text” value=”Make it simple” id=”TextBox1″ style=”background-color:Aqua;” />

Here is the ASP MVC server side circle.

lab_1.7