Dec 19, 2014, 4:35 AM
[CLOSED] combobox value disappear after button click
Hi
I have a combobox and a button ,and the button set with AutoPostback="true",after click on button combobox value disappear,please run the test case,also I found EmptyValue property not present in combobox.
Sample Aspx
I have a combobox and a button ,and the button set with AutoPostback="true",after click on button combobox value disappear,please run the test case,also I found EmptyValue property not present in combobox.
Sample Aspx
<html>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" DisableViewState="false" />
<ext:ComboBox runat="server" ID="cmpDepartment" Editable="true" DisplayField="DepartmentName" ValueField="DepartmentID" TypeAhead="true"
EmptyText="All">
<Triggers>
<ext:FieldTrigger Icon="Clear" HideTrigger="true">
</ext:FieldTrigger>
</Triggers>
<Listeners>
<Select Handler="this.getTrigger(0).show();" />
<BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<TriggerClick Handler="if (index == 0) {
this.clearValue();
this.getTrigger(0).hide();
}" />
</Listeners>
<Store>
<ext:Store
runat="server"
ID="DepartmentStore">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="DepartmentID">
<Fields>
<ext:ModelField Name="DepartmentID" Type="Int" />
<ext:ModelField Name="DepartmentName" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
<ext:DisplayField runat="server" ID="df" PaddingSpec="0 0 0 25" Html=" "></ext:DisplayField>
<ext:Button runat="server" ID="btn" OnClick="btn_Click" Text="Click" AutoPostBack="true"></ext:Button>
</form>
</body>
</html>
Sample Codepublic partial class delayed_event : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadCombo();
}
}
private void LoadCombo()
{
Department d ;
List<Department> _d = new List<Department>();
for (int i = 0; i <= 4; i++)
{
d = new Department();
d.DepartmentID = i;
d.DepartmentName = "Department - " + i.ToString();
_d.Add(d);
}
DepartmentStore.DataSource = _d;
DepartmentStore.DataBind();
}
protected void btn_Click(object sender, EventArgs e)
{
}
}
public class Department
{
public int DepartmentID { get; set; }
public string DepartmentName { get; set; }
}
Last edited by Daniil; Feb 25, 2015 at 9:13 AM.
Reason: [CLOSED]