Disabling the button after once click

后端 未结 9 1676
遥遥无期
遥遥无期 2020-11-28 09:32

I need to disable a button once it\'s clicked so the user can\'t click it more than once. (My application is written in MVC ASP.NET, I\'ve done this in a normal ASP.NET appl

9条回答
  •  -上瘾入骨i
    2020-11-28 10:08

    protected void Page_Load(object sender, EventArgs e)
        {
            // prevent user from making operation twice
            btnSave.Attributes.Add("onclick", 
                                   "this.disabled=true;" + GetPostBackEventReference(btnSave).ToString() + ";");
    
            // ... etc. 
        }
    

提交回复
热议问题