1. Get the dropdownlist Control Value
Function getdllvalue (ID ){
VaR r = Document. getelementbyid (ID );
For (VAR I = 0; I <R. length; I ++ ){
If (R [I]. Selected ){
Return R [I]. text;
}
}
}
PS: ID is the Control ID, which must be enclosed by quotation marks.
VaR text = getdllvalue ("ddlcustomerlevel ");
2. Obtain the radiobuttonlist control value.
// Obtain the value of the selected item
Function selectradiobuttonlistvalue (ID ){
VaR r = Document. getelementbyid (ID );
VaR P = R. getelementsbytagname ("input ");
For (VAR I = 0; I <p. length; I ++ ){
If (P [I]. Checked ){
Return P [I]. value;
}
}
}
// Convert the radiobuttonlist control to enumerate Chinese values based on the obtained value
Function getrbltext (RVA ){
Switch (RVA ){
Case 0:
Return "already ";
Break
Case 1:
Return "not ";
Break
Default:
Return "not ";
}
}
PS: ID is the Control ID, which must be enclosed by quotation marks.
VaR text = getrblnettypetext (selectradiobuttonlistvalue ("rblnettype "));
3. The dropdownlist control appears in ASP. NET. After the value is selected, it is restored to the first default by default. There are two reasons for this situation:
First: No ispostback judgment
Type 2: When datasource values are assigned, the corresponding datavaluefield has repeated values.