Sep 29, 2010, 7:26 AM
[CLOSED] [1.0]Problem with directMethod from custom Combobox
Hi, i have a problem with directmethod.
I create a compositefield server-side with a combobox inside.
The combobox is linked with a store in the page and had a directmethod on select attached.
I can create the compositefield whit combo correctly, but when i select an item in the combo, instead of calling directmethod, appears an error:
it can't find the control.
there is the code:
I create a compositefield server-side with a combobox inside.
The combobox is linked with a store in the page and had a directmethod on select attached.
I can create the compositefield whit combo correctly, but when i select an item in the combo, instead of calling directmethod, appears an error:
The control with ID 'comboExample' not found
[HttpException (0x80004005): The control with ID 'comboExample' not found]
Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1738
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
[HttpException (0x80004005): The control with ID 'comboExample' not found]
Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1738
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
there is the code:
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Store1.DataSource = new object[]
{
new object[] { "AL", "Alabama", "The Heart of Dixie" },
new object[] { "AK", "Alaska", "The Land of the Midnight Sun" },
new object[] { "AZ", "Arizona", "The Grand Canyon State" },
new object[] { "AR", "Arkansas", "The Natural State" },
new object[] { "CA", "California", "The Golden State" }
};
this.Store1.DataBind();
}
protected void creaRiga(object sender, DirectEventArgs e)
{
CompositeField cmp = BuildComposite();
cmp.AddTo(this.pnlCat1);
}
private CompositeField BuildComposite()
{
ComboBox cmb = new ComboBox
{
ID = "comboExample",
TriggerAction = TriggerAction.All,
DisplayField = "state",
ValueField = "abbr",
EmptyText = "choose",
Width = Unit.Pixel(200),
Editable = false,
Enabled = false
};
cmb.Store.Add(Store1);
cmb.DirectEvents.Select.ExtraParams.Add(new Ext.Net.Parameter("Condizione", "2"));
cmb.DirectEvents.Select.ExtraParams.Add(new Ext.Net.Parameter("Riga", "2"));
cmb.DirectEvents.Select.Event += new ComponentDirectEvent.DirectEventHandler(caricaCombo);
Store1.DataBind();
CompositeField cmpF = new CompositeField
{
ID = "Composite2Cat1",
Items =
{
cmb
}
};
return cmpF;
}
protected void caricaCombo(object sender, DirectEventArgs e)
{
//do something
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head2" runat="server">
<title>Example</title>
<link href="App_Themes/examples.css" rel="stylesheet" type="text/css" />
<link href="App_Themes/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="abbr" />
<ext:RecordField Name="state" />
<ext:RecordField Name="nick" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:Panel ID="pnlCat1" runat="server" AutoWidth="true" Padding="4" Title="Condizione 1" >
<TopBar>
<ext:Toolbar ID="Toolbar2" runat="server">
<Items>
<ext:ToolbarFill ID="ToolbarFill2" runat="server" />
<ext:Button ID="Button4" runat="server" Icon="Add">
<DirectEvents>
<Click OnEvent="creaRiga"></Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
</Items>
</ext:Panel>
</form>
</body>
</html>
Regards.
Last edited by Daniil; Sep 29, 2010 at 6:43 PM.
Reason: [CLOSED]