| |
collie
Posts: 10
Score: 0
Joined: 2/11/2008
Status: offline
|
Hi, I have the following code that creates and populates a dropdownlist. I have a session called DDLSearchWithin that gets its value from a querystring. The ddl appears as follows: <select name=kbid> <option value=1>Pink <option value=2>Red etc.. DDLSearchWithin contains Pink or Red etc and not 1 or 2. I need to add another session called searchkbid and give it the value 1 or 2 based on what the value of DDLSearchWithin is. The ddl gets selected with the value from the session DDLSearchWithin as can be seen in the code below. How can I assign the value 1 or 2 to the session searchkbid according to the selected value in the ddl? Thanks if sscope = "kb" then sqlStr = "select distinct kba_id, kba_name, cpk_order from tb_knbCPortalKB, tb_knbKnowledgeBase, tb_knbArticleGroupAccess, tb_knbCPortalUserSecurity, tb_knbArticle order by cpk_order, kba_name" end if set rsSearch = dbconnSearch.Execute(sqlStr) %> <% if not rsSearch.eof then %> <tr> <td> <select name="kbid" class="defaultText" onchange="setSearchWithin();document.searchform.search.value = 0;document.searchform.kbchange.value=1;document.searchform.submit();"> <% do while not rsSearch.eof rsSearch.MoveNext loop rsSearch.MoveFirst %> <% do while not rsSearch.eof %> <% if (session("DDLSearchWithin")<>"") then %> <option value="<%=rsSearch("kba_id")%>" <%if session("DDLSearchWithin") & "" = rsSearch("kba_name") & "" then%> selected<%end if%>> <%=rsSearch("kba_name")%> <%else%> <option value="<%=rsSearch("kba_id")%>"<%if session("searchkbid") & "" = rsSearch("kba_id") & "" then%> selected<%end if%>> <%=rsSearch("kba_name")%> <%end if%> <% rsSearch.movenext %> <% loop %> </select>
|
|