When registering a user, you need to filter out different products in the database based on different user types. Think about it. The best way to do this is to do nothing new.
Foreground steps: (js)
Function fillProduction ()
{
Var dwl = document. all ("DropdownlistLevel ");
Var htp = new ActiveXObject ("microsoft. xmlhttp ");
Var url = "reg. aspx? Fp = "+ dwl. value; htp. open (" POST ", url, false );
Htp. setRequestHeader ("Content-Type", "application/x-www-form-urlencoded") htp. send ();
Var str = htp. responseText;
If (str! = "")
{
Var mydata = str. split ("$ ");
If (mydata [0]! = 0)
{
For (var I = 1; I <= mydata [0]; I ++)
{
Var tmp = mydata [I]. split ("@");
Var item = new Option ();
Item. text = tmp [0] + "|" + tmp [1] + "BV"; item. value = tmp [2]; document. submit. dropDwonListProduction. options [I-1] = item;
}
Document. submit. hidpid. value = document. submit. DropDwonListProduction. value;
}
Else
{
Var len = document. submit. DropDwonListProduction. options. length;
For (var I = len-1; I> = 0; I --)
{
Document. submit. DropDwonListProduction. options. remove (I );
}
Document. submit. hidpid. value = "";
}
}
Htp = null;
}
Background code:
Private void fillProduction ()
{
String SQL;
SQL = "select pgr_prod_descr, pgr_bv_value, values from prod_grp t where t. pgr_bv_value = (select dal_bv from def_acct_level where dal_id =" + Request ["fp"] + ")";
DataTable dt;
Dt = SQLHelper. FillDataTable (SQLHelper. CONN_STRING, CommandType. Text, SQL );
String tmp;
If (dt. Rows. Count> 0)
{
Tmp = dt. Rows. Count. ToString () + "$ ";
For (int I = 0; I <= dt. Rows. Count-1; I ++)
{
Tmp = tmp + dt. rows [I] [0]. toString () + "@" + dt. rows [I] [1]. toString () + "@" + dt. rows [I] [2]. toString () + "$ ";
}
}
Else
{
Tmp = "0 $ ";
}
Response. Write (tmp );
}