views:

123

answers:

2

I have a textbox and a dropdownlist

the textbox has

<asp:TextBox ID="TxtInizioPeriodo" runat="server" 
                        ontextchanged="InizioPeriodo_TextChanged" AutoPostBack="true" Width="100"></asp:TextBox>

i want if it changes the dropdownlist return to default value selected i try to pur in page load this:

SelectDestinazione[i].SelectedValue = "";

but it now works. how can i do?

thanks

A: 

I assume SelectDestinazione is your dropdownlist

SelectDestinazione.clearSelection();

Saar
A: 

In your code you have mentioned like

Array of Dropdownlist ie.,

SelectDestinazione[i].SelectedValue = "";

in the above code "i" selects dropdownlist object from the array of dropdownlists.

Kindly check that one. If its is the single dropdownlist box then use the below solution.

Copy & paste the below code in the server side during the text content change event.

  protected void InizioPeriodo_TextChanged(object sender, EventArgs e)
  {
      SelectDestinazione.SelectedIndex = -1;
  }
solairaja
thanks it worked withprotected void InizioPeriodo_TextChanged(object sender, EventArgs e) { SelectDestinazione.SelectedValue = ""; }
Luca Romagnoli
kindly vote when u accept the answer
solairaja