The effect of the target: two drop-down frames, the second followed the first change, using the client script JavaScript implementation in the ASP.NET environment.
Step 1: Establish a JavaScript script:
Create and register this JS script in Page_Load:
String scriptkey = "menuchange";
IF (! page.isstartupscriptregistered (scriptkey) &&! Page.ispostback)
{
String scriptblock =
@ "
Function initbigclass ()
{
Bigclass = new array ();
Bigclass [0] = new array ();
Bigclass [0] [0] = '0';
Bigclass [0] [1] = 'All Forum';
Bigclass [1] = new arrival ();
Bigclass [1] [0] = '3';
Bigclass [1] [1] = 'Web Development';
Bigclass [2] = new array ();
Bigclass [2] [0] = '4';
Bigclass [2] [1] = 'Software Engineering / Management';
}
Function INitsMallClass ()
{
Smallclass = new array ();
Smallclass [0] = new arch ();
SmallClass [0] [0] = '301';
SmallClass [0] [1] = 'ASP';
SmallClass [0] [2] = '3'; // This point corresponds to the above major class
Smallclass [1] = new arch;
SmallClass [1] [0] = '303';
SmallClass [1] [1] = 'PHP';
SmallClass [1] [2] = '3';
Smallclass [2] = new arch ();
Smallclass [2] [0] = '401';
Smallclass [2] [1] = 'software engineering';
SmallClass [2] [2] = '4';
Smallclass [3] = new arch ();
SmallClass [3] [0] = '403';
SmallClass [3] [1] = 'software test'
SmallClass [3] [2] = '4';
}
INITBIGCLASS ();
INITSMALLCLASS ();
Function ChangeItem (MyFRM) // Main JS function! ! !
{
Var SelectedBigID, I, J;
For (i = myfrm.smallclassid.options.Length-1; i> = 0; - i)
{
Myfrm.smallclassid.Options [i] = null;
}
SELECTEDBIGID = Myfrm.bigclassid.Options [myfrm.bigclassid.selected "]]] .value; j = 0;
For (i = 0; i { IF (SELECTEDBIGID == SmallClass [i] [2]) { Myfrm.smallclassid.Options [j] = new option (SmallClass [i] [1], smallclass [i] [0]); J; } } } // -> script> Page.RegisterClientScriptblock (ScriptKey, Scriptblock); // Register this script } Step 2: Add two ... select> select> Note that the ID of the SELECT and the NAME property are consistent with the JS above. Step 3: Add code in Button_onclick () INT I; For (i = 0; i IF (Request.form.AllKeys [i] .tostring () == "smallclassid") Break; // Find this Select from Form (according to ID or NAME Find) INT selectionValue = Request.form.GetValues (i) [0]; // This value is SELECT Selected value