codice:
<%
set rstabval = Server.CreateObject("ADODB.Recordset")
set rsp = Server.CreateObject("ADODB.Recordset")
if categoria <> "0" then
sqlTot = "SELECT I_properties.ID, I_Properties.Name, I_Props.[Value], I_Props.ID_Item FROM I_Properties INNER JOIN I_Props ON I_Properties.ID = I_Props.ID_Properties INNER JOIN Item ON I_Props.ID_Item = Item.ID WHERE (I_Props.ID_Item = " & itemid & ") AND I_Properties.ID IN (SELECT ID_Properties FROM I_Props)"
else
sqlTot = "SELECT I_properties.ID, I_Properties.Name, I_Props.[Value], I_Props.ID_Item FROM I_Properties INNER JOIN I_Props ON I_Properties.ID = I_Props.ID_Properties INNER JOIN Item ON I_Props.ID_Item = Item.ID WHERE I_Properties.ID IN (SELECT ID_Properties FROM I_Props)"
end if
set RsTot = Server.CreateObject("ADODB.Recordset")
RsTot.Open sqlTot, conn, 1, 3
i = 0
do while not RsTot.EOF
i = i + 1
if i MOD 2 = 0 then
colour = ("#E4ECFB")
else
colour = ("#FFFFFF")
end if
set rsvaldef = Server.CreateObject("ADODB.Recordset")
nameproperties = RsTot("Name") '''''''recupero il nome della proprietà usando il recordset vecchio
sqlp = "SELECT * FROM I_Properties WHERE Name='" & nameproperties & "'"
set rsvaldef = conn.execute(sqlp)
idproperties = rsvaldef("ID")
mandatorio = rsvaldef("Mandatory")
tipo = rsvaldef("Type")
definito = rsvaldef("Defined_Value")
editable = rsvaldef("Editable")
rsvaldef.close
if definito = true then
sqldef = "SELECT * FROM Prop_Value WHERE ID_Properties=" & idproperties & "AND Table_Name='I_Properties'"
set rsp = conn.execute(sqldef)
do while not rsp.EOF
cont = cont + 1
valore = rsp("Value")
Session("valori") = Session("valori") + valore & ";"
rsp.movenext
loop
end if
%>
<tr>
<td width="30%" bgcolor="<%=colour%>" style="border-left: 1px dotted #D3D3D3; border-right: 1px dotted #D3D3D3" align="left">
<font color="#014E82"><%=nameproperties%> </font>
</td>
<td width="45%" height="13" bgcolor="<%=colour%>" style="border-left: 1px dotted #D3D3D3; border-right: 1px dotted #D3D3D3">
<p align="center">
<%
if tipo = "stringa" then
if editable = True OR editable = "" then
%>
<input type="text" name="<%=idproperties%>" value="<%=RsTot("Value")%>" size="30">
<%
else
%>
<input type="text" name="<%=idproperties%>" value="<%=RsTot("Value")%>" size="30" disabled>
<%
end if
end if
if tipo = "check" then
sqlprop2 = "SELECT * FROM I_Props WHERE ID_Item=" & itemid & "AND ID_Properties=" & idproperties & ""
set rstabval = conn.execute(sqlprop2)
table_value = rstabval("Value")
if table_value="ON" then
ck = "checked"
else
ck = ""
end if
if editable = True then
%>
<INPUT TYPE="checkbox" NAME="<%=idproperties%>" VALUE="ON" <%=ck%> onClick="verify(checkbox.value, <%=idproperties%>)">
<script language="javascript">
function verify(value, nome) {
if value == "ON" {
value = "OFF"
} else {
value = "ON"
}
nome.value = value
}
</script>
<%
else
%>
<input type="checkbox" name="<%=idproperties%>" value="ON" <%=ck%> disabled> <%
end if
end if
if tipo = "menu" then
if definito = true then
valori = split(Session("valori"), ";")
c = UBound(valori)
redim ciccio(c)
k = 0
%>
<%
if editable = True then
ed = ""
else
ed = "disabled"
end if
%>
<select name="<%=idproperties%>" <%=ed%>>
<%
sqlprop2 = "SELECT * FROM I_Props WHERE ID_Item=" & itemid & "AND ID_Properties=" & idproperties & ""
set rstabval = conn.execute(sqlprop2)
table_value = rstabval("Value")
if mandatorio = False AND table_value = "" then
%>
<option></option>
<%
end if
if table_value <> "" then
%>
<option value="<%=table_value%>"><%=table_value%></option>
<option></option>
<%
end if
for k=0 to UBound(valori)-1
finale = valori(k)
%>
<option value="<%=finale%>"><%=finale%></option>
<%
next
%>
</select>
<%
end if
end if
%>
</td>
<td width="13%" height="13" bgcolor="<%=colour%>" style="border-left: 1px dotted #D3D3D3; border-right: 1px dotted #D3D3D3" align="center">
<%
if mandatorio = true then
%>
<p align="center">
[img]../images/xyes.gif[/img]
<%
else
%>
[img]../images/xno.gif[/img]
<%
end if
%>
</td>
<td width="12%" height="13" bgcolor="<%=colour%>" style="border-left: 1px dotted #D3D3D3; border-right: 1px dotted #D3D3D3" align="center">
<%
if editable = true then
%>
[img]../images/xyes.gif[/img]
<%
else
%>
[img]../images/xno.gif[/img]
<%
end if
%>
</td>
</tr>
<%
Session("valori") = ""
RsTot.movenext
loop
%>
<tr>
la parte che ci interessa è quella in rosso...io c'ho provato così,che penso sia più o meno quello che dici tu.
in parole il codice controlla il tipo di proprietà (variabile tipo) se è uguale a "check" ed è editabile allora mi da un checkbox normale,altrimenti uno uguale tranne che disabled.
è un po' un casino fartelo vedere così ma era l'unico modo per fartelo capire bene (penso...e spero...)
se ci riesci diventi il mio idolo...grazie mille,chiedimi pure qualsiasi dubbio hai sul codice