May 23, 2011, 7:37 PM
[CLOSED] Clear combobox list items in the code behind
I made a search in the fórum, but I didn't find any help.
How can I clear combobox list items in the code behind during ajax request?
I have to clear old items and add new items to the list.
I'm not using store.
designer code
How can I clear combobox list items in the code behind during ajax request?
I have to clear old items and add new items to the list.
I'm not using store.
designer code
<ext:Button runat="server" ID="MyButton" Text="Test Combo" X="150" Y="180">
<DirectEvents>
<Click OnEvent="MyButtonClick">
</Click>
</DirectEvents>
</ext:Button>
<ext:ComboBox runat="server" ID="MyCombo" FieldLabel="Ano" X="0" Y="180" AllowBlank="false"
Width="70" />
code behindprotected void MyButtonClick(object sender, DirectEventArgs e)
{
MyCombo.Items.Clear();//not work
MyCombo.AddScript(MyCombo.ClientID + ".store.data.clear();");//not work
MyCombo.Clear();//not work
for (int i = 0; i < 20; i++)
MyCombo.AddItem("Pos " + i.ToString(), i.ToString());
}
Last edited by Daniil; May 24, 2011 at 3:18 PM.
Reason: [CLOSED]