ASP.NET without runat=server tag with C#

Category > ASP.NET || Published on : Thursday, October 17, 2019 || Views: 2439 || ASP.NET without runat=“server” tag


Here Pawan Kumar will explain how to ASP.NET without runat=server tag with C#


Now I will explain How to ASP.NET without runat=server tag with C#

So follow the steps to learn ASP.NET without runat=server tag with C#

Step 1 - Create a website using Visual Studio 2019 or any other version of visual studio as you have installed on your system.

Step 2 - Add a new Webform C# into the website created in step 1

Step 3 - Write teh following codes in aspx page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NoServerControls.aspx.cs" Inherits="examples_3_NoServerControls" %>

<!DOCTYPE html>

<html xmlns="">
    <title>ASP.NET without runat=“server”</title>
        <form method="post">
            <input type="text" name="tb1"/>
            <input type="submit" value="submit"/>

        <h1>Hello  <%= echo %></h1>

Step 4 -  Write the following codes in code behind file.

using System;

public partial class examples_3_NoServerControls : System.Web.UI.Page
    public string echo { get; set; }
    protected void Page_Load(object sender, EventArgs e)
        //Trivial example: skipping all validation checks
        //It's either a GET or POST end of day
        if (Request.RequestType == "POST")
            //Do something with data, just echoing it here
            echo = Request["tb1"];

Now run the project using F5. After entering some text in textbox and then pressing submit button. It will print that textbox content onto the webpage and we will get ASP.NET without runat=“server” tag


So, In this tutorial we have learned, ASP.NET without runat=server tag with C#

Download Source Codes