PDA

View Full Version : [FIXED] [V0.7.0] ComboBox.SelectedIndex Bug



Timothy
Oct 06, 2008, 11:11 AM
Hello,

Please see example below which is always returning SelectedIndex == -1

Example.aspx:


<%@ Page Language="C#" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected override void OnInit(EventArgs e)
{
Control control = Page.LoadControl("Example-Control.ascx");

UserControl.Controls.Add(control);

base.OnInit(e);
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" ScriptMode="Debug" />
<asp:PlaceHolder ID="UserControl" runat="server" />
</form>
</body>
</html>


Example-Control.ascx:


<%@ Control Language="C#" ClassName="Example_Control" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Permissions.DataSource = new object[] {
new object[] { 1, "Permission", "Permission 1" },
new object[] { 2, "Permission", "Permission 2" },
new object[] { 3, "Permission", "Permission 3" },
new object[] { 4, "Permission", "Permission 4" },
new object[] { 5, "Permission", "Permission 5" },
new object[] { 6, "Permission", "Permission 6" }
};
Permissions.DataBind();
}
protected void drpPermissions_Select(object sender, AjaxEventArgs e)
{
lblResults.Text = String.Concat("drpPermission.SelectedIndex=", drpPermission.SelectedIndex);
}
</script>
<ext:Store ID="Permissions"
runat="server"
AutoLoad="True"
GroupField="GroupingName">
<Reader>
<ext:ArrayReader ReaderID="PermissionId">
<Fields>
<ext:RecordField Name="PermissionId" />
<ext:RecordField Name="GroupingName" />
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:ArrayReader>
</Reader>
<SortInfo Field="DisplayName" />
</ext:Store>
<ext:ComboBox ID="drpPermission" runat="serveR"
StoreID="Permissions"
DisplayField="DisplayName"
Editable="False"
EmptyText="----"
Mode="Local"
TriggerAction="All"
TypeAhead="True"
ValueField="PermissionId"
ValueNotFoundText="----"
Width="255">
<AjaxEvents>
<Select OnEvent="drpPermissions_Select" />
</AjaxEvents>
</ext:ComboBox>
<ext:Label ID="lblResults" runat="server" Text="Waiting ..." />


Cheers,
Timothy

Vladimir
Oct 06, 2008, 11:29 AM
Hi Timothy,

Thanks for your example. The fix in the SVN

Timothy
Oct 06, 2008, 12:27 PM
Resolved, you can mark this fixed.

Cheers,
Timothy