how to reload the code in <%%> in aspx RRS feed

  • Question

  • User444096333 posted


       in my aspx there is 

    <% var disPlayItems= ListDisplay(0,0); %> 

     ListDisplay is in C# code to read db, according to the input parameters.

     and the paramters , although when page was load, is 0 , but in fact it depends on values of dropdown.

    the displayed itesm are in  <li></li>

    My problem is , when the users change value of dropdown, the ListDisplay is called, but the layout in<%  %> is not changed.

    how to reload the aspx to let it execute ListDisplay? thank you very much

    Monday, March 23, 2020 1:59 PM

All replies

  • User475983607 posted

    Set the DropDownList's attribute AutoPostBack=true to cause a post back when the dropdown changes.


    Monday, March 23, 2020 2:37 PM
  • User281315223 posted

    If you are looking to update a specific area of a Web Form, you might consider leveraging an UpdatePanel, which would cause essentially a full page refresh to only be applied to a single area of your page. Basically, configure your DropDown control to trigger a postback via the AutoPostBack=true property, which would cause a full page reload (or if you configure your UpdatePanel, only the panel itself to be rerendered).

    This related question covers a few examples that rely on an UpdatePanel being driven by a DropDownList that might be worth exploring.

    Monday, March 23, 2020 2:37 PM
  • User-258456925 posted

    This is not clear exactly what you're looking for. It would be great if you could provide some sample code that you've done. It'll help us to reply proper answers and suggessions.

    Wednesday, March 25, 2020 1:29 PM