Asp Classic - Keep option select post on page

1

People need help.

I have the following ceiling of select HTML

<select id="lstTransacao" name="lstTransacao">
     <option value="null">Todos</option>
     <option value="1">Confirmados</option>
     <option value="0">Não confirmados</option>
</select>

<input id="btnFiltrarTransacao" type="submit" name="btnSearch" value="Filtrar Transações" class="style_button" onclick="javascript: filtraTransacao();">

It's a page that does a search. It turns out that the page has pagination, when I click the paging button "1", "2", "3", etc. The SELECT returns to the default "all", I would like to keep if I click "Unconfirmed" go past the page and keep OPTION VALUE="0" for example.

ASP Classic 3.0

Thank you.

    
asked by anonymous 26.01.2015 / 13:26

2 answers

3

In pagination switching, you need to tell each page the value that was previously selected in <select> . Then you capture the value that was sent in submit and compares each <option> :

<%lstTransacao = request("lstTransacao")%>

<select id="lstTransacao" name="lstTransacao">
     <option <%if lstTransacao = "null" then%> selected="selected" <%end if%> value="null">Todos</option>
     <option <%if lstTransacao = "1" then%> selected="selected" <%end if%> value="1">Confirmados</option>
     <option <%if lstTransacao = "0" then%> selected="selected" <%end if%> value="0">Não confirmados</option>
</select>

<input id="btnFiltrarTransacao" type="submit" name="btnSearch" value="Filtrar Transações" class="style_button" onclick="javascript: filtraTransacao();">
    
25.03.2015 / 01:07
0

Good morning. One suggestion would be to create a label just get its value in the postback and would treat the combobox with Jquery ...

This tip can be improved.

 <div id="mydiv" class="0">   
  <select id="lstTransacao" name="lstTransacao" >
   <option value="null">Todos</option>
   <option value="1">Confirmados</option>
   <option value="0">Não confirmados</option>
  </select>
 </div>
$("body").ready(function () {
  if ($('#mydiv').hasClass('0')) {
  $("#lstTransacao").val('0');        
}});
    
12.02.2015 / 12:10