Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem with DropDown and ASP

Peace2uPeace2u Member Posts: 14
Hi everybody,

I am getting infos from a database to get a drop down list filled. When I submit the form I want to automatically select the selected item but it doesn't select. Heres my code where it doesn't work.


<% Do While not rsCountries.EOF %>
" <% if Request.Form("ddlSearchCountry") = rsCountries("CountryID") then %> selected <% end if %>>
<% = rsCountries("Country") %>

<% rsCountries.MoveNext
loop
rsCountries.close%>

I've done this tones of time but this time it just won't work. The Request.Form works because i checked if it gets filled by putting it beside <% = rsCountries("Country") %>.

Thank you in advance,

Andy

Comments

  • Peace2uPeace2u Member Posts: 14
    Hi everybody,

    My Values are numeric. what I did was to convert my Request.Form and recordset values both to Int and then it worked.


    <% Do While not rsCountries.EOF %>
    " <% if cint(DistributorCountryID) = cint(rsCountries("CountryID")) then%>selected<%end if%>><% = rsCountries("Country") %>
    <% rsCountries.MoveNext
    loop
    rsCountries.Close%>


    /Peace2u my friends
Sign In or Register to comment.