A simple record of this method: ASP. NET uses the backgroundCodeAdd client-side JS methods to the server control
The front-end code is as follows:
<% @ Page Language = " C # " Autoeventwireup = " True " Codebehind = " Webform1.aspx. CS " Inherits = " Webapplication1.webform1 " %> <! Doctype HTML> <HTML xmlns =" Http://www.w3.org/1999/xhtml " > <Head runat = " Server " > <Title> </title> <SCRIPT src = " Scripts/jquery-1.9.0.min.js " > </SCRIPT> " Form1 " Runat = " Server " > <Div> <asp: radiobutton id = " Radiobutton1 " Runat = " Server " Groupname = " Ericsun " /> <Asp: textbox id = " Textbox1 " Runat = " Server " > </ASP: textbox> <br/> <asp: radiobutton id = " Radiobutton2 " Runat = " Server " Groupname = " Ericsun " /> </Div> </form> </body> " Text/JavaScript " >Function radiobtnonclick (OBJ) {$ ( " # <% = Textbox1.clientid %> " ). ATTR ( ' Disabled ' , ' Disabled ' );} </SCRIPT>
Background code:
Using System; Using System. Collections. Generic; Using System. LINQ; Using System. Web; Using System. Web. UI; Using System. Web. UI. webcontrols; Namespace Webapplication1 { Public Partial Class Webform1: system. Web. UI. Page { Protected Void Page_load ( Object Sender, eventargs e ){ This . Radiobutton1.inputattributes. Add ( " Onclick " , " Radiobtnonclick (this ); " ); This . Radiobutton2.inputattributes. Add ( " Onclick " , " Radiobtnonclick (this ); " );}}}
....