[Solved] Issue of LinkButton not working after disabling JS in []

The LinkButton in is similar to a regular HyperLink but with the added functionality of the OnClick event. However, upon analyzing the generated code in Chrome or Firefox, it was discovered that the implementation of the OnClick event is done through JavaScript. Therefore, if JavaScript is disabled in the browser, the LinkButton will not work. Here is an example of the code generated for a simple LinkButton:


The href attribute in the above code indicates that the click event is implemented by posting back to the server. By analyzing the code above, it can be determined that only two control parameters need to be sent to the server to notify it to handle the click event, using the GET method. Therefore, the following code can be used:

Fake LinkButton1

After running the code, it was found that clicking on the code we created resulted in an error on the server. The reason is that client-side event validation is enabled on the server. To disable client-side event validation, add the following attribute code to the header section of the aspx page:


This will disable client-side event validation and allow calling server events without using JavaScript.

Complete code for Default.aspx:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false" %>

Real LinkButton1  
[Fake LinkButton1](?__EVENTTARGET=ctl00$MainContent$LinkButton1&__EVENTARGUMENT=)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)


protected void LinkButton1_Click1(object sender, EventArgs e)
    // This is a test code
    int a = 1;
    int b = 1;


Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.