Mar 31, 2009, 4:31 PM
TabPanel and ComboBox
Hello,
The following example demonstrates that the SetValue of the ComboBox does not appear to be working:
Example.aspx:
1. Load page
2. Switch to 2nd tab, notice --- and the items available
3. Switch back to 1st tab
4. Click Load ...
5. Notice it doesn't select Timothy
Side note, I also used SetValueAndFireSelect() which also didn't work.
Cheers,
Timothy
The following example demonstrates that the SetValue of the ComboBox does not appear to be working:
Example.aspx:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
ComboBox1.SetValue(1);
TabPanel1.SetActiveTab(Tab2);
}
protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
{
Store1.DataSource = new object[] {
new object[] { 1, "Timothy" },
new object[] { 2, "Geoffrey" }
};
Store1.DataBind();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" EnablePartialRendering="True" />
<ext:ScriptManager runat="server" AjaxViewStateMode="Include" EnableViewState="true" Theme="Gray" />
<ext:TabPanel ID="TabPanel1" runat="server" Border="false">
<Tabs>
<ext:Tab ID="Tab1" runat="server" AutoHeight="true" Title="Tab 1">
<Body>
<ext:Button ID="Button1" runat="server" AutoPostBack="true" onclick="Button1_Click" Text="Load ..." />
</Body>
</ext:Tab>
<ext:Tab ID="Tab2" runat="server" AutoHeight="true" Title="Tab 2">
<Body>
<ext:Store ID="Store1"
runat="server"
AutoLoad="true"
IgnoreExtraFields="true"
OnRefreshData="Store1_RefreshData">
<Proxy>
<ext:DataSourceProxy />
</Proxy>
<Reader>
<ext:ArrayReader ReaderID="Id">
<Fields>
<ext:RecordField Name="Id" Type="Auto" />
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:ComboBox ID="ComboBox1"
runat="server"
StoreID="Store1"
DisplayField="DisplayName"
Editable="true"
EmptyText="----"
FireSelectonload="true"
ForceSelection="true"
Mode="Local"
Selectonfocus="true"
TriggerAction="All"
TypeAhead="true"
ValueField="Id"
Width="255" />
</Body>
</ext:Tab>
</Tabs>
</ext:TabPanel>
</form>
</body>
</html>
Replication steps:1. Load page
2. Switch to 2nd tab, notice --- and the items available
3. Switch back to 1st tab
4. Click Load ...
5. Notice it doesn't select Timothy
Side note, I also used SetValueAndFireSelect() which also didn't work.
Cheers,
Timothy