How to change the value of an asp:textbox from javascript

前端 未结 4 1117
故里飘歌
故里飘歌 2021-01-06 23:48

I have an asp:textbox


and when a user clicks the \"Cancel\" button, I want to erase w

4条回答
  •  北海茫月
    2021-01-07 00:38

    Try setting the textbox's ClientIDMode to Static

    That way the javascript should be able to find them with the same ID as in ASPX.

    Here a whole test page

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




提交回复
热议问题