日期:2014-05-17  浏览次数:21057 次

根据ID值 栏目下拉列表显示问题
<%
Set rsChannels = Server.CreateObject(OBJ_RST)
sql = "select * from Li_Channels"
rsChannels.open sql, conn,1,1
if not (rsChannels.eof and rsChannels.bof) then
do while not rsChannels.eof
if rsChannels("ChannelsID") = request("ChannelsID") then
response.Write("<option value='"& rsChannels("ChannelsID") &"' selected='selected'>"& rsChannels("ChannelsName") &"</option>")
else
response.Write("<option value='"& rsChannels("ChannelsID") &"'>"& rsChannels("ChannelsName") &"</option>")
end if
rsChannels.movenext
loop
end if
rsChannels.close
set rsChannels=nothing
%>

class.asp?ChanelsID=15 (根据这个ID不一样,下拉列表就显示哪个)

------解决方案--------------------
if not isnull(rsChannels("ChannelsID")) and rsChannels("ChannelsID")<>"" then


if cstr(rsChannels("ChannelsID")) = cstr(request("ChannelsID")) then
response.Write("<option value='"& rsChannels("ChannelsID") &"' selected='selected'>"& rsChannels("ChannelsName") &"</option>")
else
response.Write("<option value='"& rsChannels("ChannelsID") &"'>"& rsChannels("ChannelsName") &"</option>")
end if


end if