私はaspclassic(.netなし)を使用しています。ユーザーのリストがあり、ユーザー(id_rolで並べ替えられている)が変更されたとき、たとえばユーザーが検索した場合に、ある種のラベルを付けようとして立ち往生しています。最初のオプションのリスト( "Todos")は、すべてのユーザーを表示できることを意味しますが、彼が1に見える場合、id_rol = 1の10人のユーザーを表示でき、このリストの12の場所を見ると、「Editor」というラベルが表示されます。他の10人のユーザーを示していますが、私の問題は、オプションが0の場合はTODOを示し、1の場合はDIRECTORを示し、以下のユーザーを示し、選択が12の場合はDIGITADORを示し、その説明は、リスト内の場所が22の場合、EDITORを示し、続行します。
rigthは、0、1、2、および3の場所にオプションがあることを示していますが、0、1、12、および22の場所にオプションが必要ですか?お願いします。これが私のコードです:
function cb_usuarios(cod_usuario)
'response.write seccion&"<*------"
sql=" select * from usuarios where 1=1"
'sql=" select * from usuarios where 1=1 order by id_rol asc"
if Session("id_perfil") ="1" then sql = sql &" and id_rol in(3,4)"
if Session("id_perfil") ="2" then sql = sql &" and id_rol=3"
if Session("id_perfil") ="3" then sql = sql &" and id_rol in(3,4,7)"
if Session("id_perfil") ="4" then sql = sql &" and id_rol in(1,7,6)"
if Session("id_perfil") ="6" then sql = sql &" and id_rol in(7,4)"
'sql = sql &" order by nombre "
sql = sql &" order by id_rol "
'if(id_rol=1)then
'response.write director
'else
'response.write('esto es una prueba')
'response.write sql
Set rsx = Server.CreateObject("ADODB.Recordset")
rsx.Open SQL, conexion, 3
%>
Usuarios<select name="usuarios" class="filtros">
<option selected value="0">TODOS</option>
<option selected value="1">DIRECTOR</option>
<option selected value="12">DIGITADOR</option>
<option selected value="22">EDITOR</option>
<%
while not rsx.eof
if ( trim(rsx("usuario")) = trim(cod_usuario)) then
sel="Selected"
else
sel=""
end if
%>
<option select value="<%=rsx("usuario")%>" <%=sel%>><%=rsx("nombre")%></option>
<%
rsx.movenext
wend
rsx.close
%></select><%
end function