Creating a hidden field in codebehind and accessing it via clientside javascript

前端 未结 2 1195
陌清茗
陌清茗 2021-01-24 07:24

I want to add a hidden field programmatically to an asp.net page, read and change it via javascript. So far my code fails at reading the added hidden field.

Here is a si

2条回答
  •  耶瑟儿~
    2021-01-24 07:58

    The main problem was that the following line was missing in the aspx page:

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

    The codebehind was never executed.

提交回复
热议问题