-2

我正在根据复选框值进行一些搜索。如果我选择一个复选框,我需要一个值,如果我选择第二个复选框也需要 2 个复选框值。

目前我有带有单选按钮的代码。需要将它们转换为具有多个选择的复选框。根据请求值,它将传递给存储过程。

<% if request("view")="Key CIA Initiative" then %>
<input type="radio" checked="checked" 
   onclick="javascript:document.location='Index.asp?view=Key CIA Initiative'" />
<input type="radio" onclick="javascript:document.location='Index.asp?view=High'" />
<input type="radio"  onclick="javascript:document.location='Index.asp'" />

<% else %>

<% if request("view")="High" then %>
<input type="radio"  onclick="javascript:document.location='Index.asp?view=Key            
 Initiative'" />
<input type="radio" checked="checked" onclick="javascript:document.location='Index.asp?
view=High'" /> 
<input type="radio"  onclick="javascript:document.location='Index.asp'" />
<% else %>
<input type="radio"  onclick="javascript:document.location='Index.asp?view=Key CIA 
Initiative'" />
<input type="radio"  onclick="javascript:document.location='Index.asp?view=High'" />
<input type="radio"  onclick="javascript:document.location='Index.asp'" /> 
<%end if%>
<%end if%>       

单击单选按钮时,它会重定向到具有请求值的同一页面,然后我将传递给存储过程

 If request("view")="Key CIA Initiative" Then
  strSQL = "Exec sp_get_Project_list 'Key CIA Initiative' "
 Else
 If  request("view")= "High" then
  strSQL="Exec sp_get_Project_list 'High' "
 Else 
  strSQL="Exec sp_get_Project_list "
 end if
 end if
4

1 回答 1

0

你将不得不做这样的事情:

<%
Response.write "Request(view)="& request("view") & "<br />"
'Now, if request("view") has nultiple values, How are you going to call the sp? 
'pass both values to it?
If Trim(Request("view"))<>"" Then

    If InStr(Request("view"),"All")<>0 Then
        strSQL="Exec sp_get_Project_list"
    Else
    strSQL = "Exec sp_get_Project_list '"& Request("view") &"'"
    End if
Response.write "strSQL ="& strSQL & "<br />"
End If
%>
<form>
<input type="checkbox" name="view" value="Key CIA Initiative" <% if InStr(request("view"),"Key CIA Initiative")>0 then %> checked="checked"<%End If%> />Key CIA Initiative <br/>
<input type="checkbox" name="view" value="High" <%if InStr(request("view"),"High")>0 then %> checked="checked"<%End If%>  />High<br/>
<input type="checkbox" name="view" value="All" <%if InStr(request("view"),"All")>0 then %> checked="checked"<%End If%> />All <br/>
<input type="submit">
</form>
于 2013-06-20T09:53:18.950 回答