HTML is as follows
Copy Code code as follows:
<tr>
<TD class= "Lefttd" style= "width:107px" > Additional amount </td>
<TD style= "width:315px" ><asp:textbox id= "Txtextendmoney" text= "0" runat= "Server" ></asp:TextBox>
<asp:regularexpressionvalidator id= "Regextend" runat= "controltovalidate=" Txtextendmoney "Display=" The Dynamic "errormessage=" format is incorrect "validationexpression=" [1-9]\d*\.\d*|0\.\d*[1-9]\d*|^[1-9]\d*|0 ></asp: Regularexpressionvalidator>
<asp:requiredfieldvalidator id= "Reqextedno" runat= "Server" controltovalidate= "Txtextendmoney" Display= "Dynamic" Errormessage= "Not nullable" ></asp:RequiredFieldValidator></td>
<TD class= "Lefttd" > Settlement method </td>
<td><asp:dropdownlist id= "Ddlpaytype" runat= "Server" ><asp:ListItem> cash </asp:ListItem>< Asp:listitem> Bank Transfer </asp:ListItem></asp:DropDownList></td>
</tr>
<tr>
<TD class= "Lefttd" > Settlement account </td>
<TD colspan= "3" ><asp:radiobuttonlist id= "Rdbpayaccountbank" runat= "server" repeatlayout= "Flow" ></ Asp:radiobuttonlist></td>
</tr>
The last RadioButtonList ListItem is "other account", and then the corresponding ASP.net server control is added after the election. Remove the control when you select another.
Increase
Introduce jquery, and then the following code
Copy Code code as follows:
/* Settlement Method * *
$ (": Radio:last"). Bind ("click", Function () {
if ($ ("#txtBankNew"). Length==0) {
$ (this). Parent (). Append (' <span id= "span" ><label style= "margin-left:6px;margin-right:4px;" for= " Txtbanknew "> Bank </label><input runat= ' server ' id= ' txtbanknew ' type= ' text '/><label style= ' Margin-left:6px;margin-right:4px "for=" Txtaccountnew "> Account </label><input type= ' text ' id= ' Txtaccountnew ' runat= ' server '/></span> ');
};
$ ("#txtBankNew"). focus (). Select ();
});
$ (": Radio:not (: Last)"). Bind ("click", Function () {
if ($ ("#txtBankNew"). Length>0) {
$ ("#span"). Remove ();
}
});
It is worth noting that if the control after the append is a server control, that is, the runat= "Server" property, the original single quote generator automatically becomes double quotes, and runat= "server" disappears. This is actually consistent with writing this DOM structure. NET Framework processing manually in the foreground. So open this page source file to see the following
Unfortunately, the server control still doesn't work ...
Or use a hidden server control to solve it-!