开发者

Getting value of drop down list problem

I have a drop down but i am unable to get the value of the selected item. If i use request.form("PageSelect") the value is 0 although i know my multidimensional array used to fill the list works.

 <select name="PageSelect" onchange="this.form.submit()" style="font-weight:bold;">
                            <option value="">[All]</option>                         
                    <%                    
                    Dim PageArray
                    Dim PageCount
                    Set c = Server.CreateObject("ADODB.Connection")
                    Set r = Server.CreateObject("ADODB.Recordset")
                    r.CursorLocation = adUseServer
                    c.open connectionstring
                    c.CursorLocation = adUseServer

                    SQL = "select * from a_page order by P_Description"

                    Set r = Server.CreateObject("ADODB.Recordset")
                    r.CursorLocation = adUseServer
                    r.Open SQL, c, adOpenForwardOnly, adLockReadOnly
                    If r.BOF or r.EOF Then
                       r.close()
                       Set r = Nothing
                    Else
                       PageArray = r.GetRows()
                       PageCount = UBound(PageArray, 2)
                       r.Close()
                       Set r = Nothing
                    End If
                    c.Close()
                    Set c = Nothing
                        for i = 0 to PageCount                        
                            if PageSelect = pageArray(0,i) then
                            %>                          
                                <option selected value="<%=pageArray(0,i) %>"><%=pageArray(1,i) %></option>
                            <%                  
                            else
                            %>
                                <option value="<%=pageArray(0,i) %>"><%=pageArray(1,i) %></option>
                            <% 
                            end if
                        next %>
                        </select>

above this code is another 2 select boxes for different items

<select id="PermissionID" name="PermissionID" onChange="this.form.submit()" style="font-weight:bold;">
                            <option value="0">[All Permissions]</option>
<%  obj_ADO.ClearParameters
    lng_RecSet1 = obj_ADO.GetFreeRecordset
    obj_ADO.Recordset "A_combo_Permissions_select", 开发者_如何学运维adCmdStoredProc, obj_Session.int_CommandTimeout, lng_RecSet1
    while obj_ADO.EOF(lng_RecSet1) = 0
        if obj_ADO.GetField(0, adValue, lng_RecSet1) = lng_PermissionID then
%>
                            <option selected value="<%=obj_ADO.GetField(0, adValue, lng_RecSet1)%>"><%=obj_ADO.GetField(1, adValue, lng_RecSet1)%></option>
<%      
        else
%>
                            <option value="<%=obj_ADO.GetField(0, adValue, lng_RecSet1)%>"><%=obj_ADO.GetField(1, adValue, lng_RecSet1)%></option>
<%
        end if
        obj_ADO.MoveNext lng_RecSet1
    wend
    obj_ADO.CloseRecordset lng_RecSet1
%>                      
                        </select>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <select multiple size="10" name="ActionPermissionID" id="ActionPermissionID">
                            <option value="">[Add/Remove Permission]</option>
<%  obj_ADO.ClearParameters
    lng_RecSet1 = obj_ADO.GetFreeRecordset
    obj_ADO.Recordset "A_combo_Permissions_select", adCmdStoredProc, obj_Session.int_CommandTimeout, lng_RecSet1
    while obj_ADO.EOF(lng_RecSet1) = 0
        if not isarray(lng_ActionPermissionID) then
            if obj_ADO.GetField(0, adValue, lng_RecSet1) = lng_ActionPermissionID then
%>
                            <option selected value="<%=obj_ADO.GetField(0, adValue, lng_RecSet1)%>"><%=obj_ADO.GetField(1, adValue, lng_RecSet1)%></option>
<%      
            else
%>
                            <option value="<%=obj_ADO.GetField(0, adValue, lng_RecSet1)%>"><%=obj_ADO.GetField(1, adValue, lng_RecSet1)%></option>
<%
            end if
        else
%>
                            <option value="<%=obj_ADO.GetField(0, adValue, lng_RecSet1)%>"><%=obj_ADO.GetField(1, adValue, lng_RecSet1)%></option>
<%
        end if
        obj_ADO.MoveNext lng_RecSet1
    wend
    obj_ADO.CloseRecordset lng_RecSet1

%>                      
                        </select>


Here was problem -

if len(Request.Form("PageSelect"))>0 and isnumeric(Request.Form("PageSelect")) then 
    PageSelect = clng(Request.Form("PermissionID"))
else
    PageSelect = 0
end if

changed to this -

if len(Request.Form("PageSelect"))>0 and isnumeric(Request.Form("PageSelect")) then 
    PageSelect = clng(Request.Form("PageSelect"))
else
    PageSelect = 0
end if
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜