javascript - Disable Button OnClick -
i have asp.net
application random generator , want button disable , stay disabled when clicked.
i have tried adding onclientclick="this.disabled = true;"
<asp:button>
, tried adding following onclick in code behind btndecideforme.attributes.add("onclick", "this.disabled=true;");
none of these work.
not bothered how done long it's clean , job.
html
<div class="col-sm-2"> <asp:button class="btn btn-success" id="btndecideforme" runat="server" text="decide me" onclick="btndecideforme_click" /> </div>
on_click event
protected void btndecideforme_click(object sender, eventargs e) { list<string> eat = new list<string>(); eat.add("chinese buffet"); eat.add("harvester"); eat.add("frankie & benny's"); eat.add("hungry horse"); eat.add("blaize"); eat.add("chiquito"); eat.add("cafe football"); eat.add("nando's"); random place = new random(); int places = place.next(0, eat.count); txtdestination.text = eat[places]; //btndecideforme.enabled = false; }
i don't want use btndecideforme.enabled = false;
loses bootstrap
styling , don't want apply whole lot of css
.
you can use below code in button click event.
btndecideforme.enabled = false;
Comments
Post a Comment