You must Sign In to post a response.
  • Category: HTML

    How to retain state of dropdown in html

    hi all i have dropdown with options 10,20,30 and given on change ="this.form.submit" so what i want is if the form reloads i want to maintain what i have selected in dropdown suppose if i have selected 20 it has to 20 in dropdown even if form is submitted below is my drop down

    <select id="dropsel" name="dropdel" onchange="this.form.submit()" >
    <option value="select">-- Select --</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
  • #769660
    You can store the information in a Hidden Field control and get the values from that control when it post backs.

    another way is

    In ASP.Net, we can add Runat="server" to html controls. They keep having HTML and preserve their state between post backs.

    B.Ramana Reddy

  • Sign In to post your comments