May 05, 2010, 10:38 AM
[CLOSED] UserControls and Events
Hi,
I will try to explain.
I have a user control with some ext controls in it. One of these control (a combo) fires a AjaxEvent, after that event in code behind a 'regular' event is throw by user control and consumed by owner page that SHOULD update some ext textfield.
Well everything works ok, except that last textfields are left untouched. I suppose the problem is related to AjaxEvent and javascript not injected to page.
I tried to change the signature of UserControl Event as
public event ComponentAjaxEvent.AjaxEventHandler but with no results.
here a (simplified) snippet.
Page
Thank you
Stefano
I will try to explain.
I have a user control with some ext controls in it. One of these control (a combo) fires a AjaxEvent, after that event in code behind a 'regular' event is throw by user control and consumed by owner page that SHOULD update some ext textfield.
Well everything works ok, except that last textfields are left untouched. I suppose the problem is related to AjaxEvent and javascript not injected to page.
I tried to change the signature of UserControl Event as
public event ComponentAjaxEvent.AjaxEventHandler but with no results.
here a (simplified) snippet.
Page
<ext:Panel runat="server" Border="false" >
<Body>
<uc3:UserControl ID="_source" runat="server" />
</Body>
</ext:Panel>
<ext:Panel runat="server">
<ext:TextField runat="server" ID="_destination" />
</ext:Panel>
----CODE BEHIND
protected void Page_Load( object sender, EventArgs e )
{
_source.Selected += new ComponentAjaxEvent.AjaxEventHandler(Selected);
}
void Selected(object sender, AjaxEventArgs e)
{
_destination.Text = e.ExtraParams["Key"];
}
UserControl<ext:ComboBox ID="_Key" >
<AjaxEvents>
<Select OnEvent="KeySelected" ViewStateMode="Include" />
</AjaxEvents>
</ext:ComboBox>
----CODE BEHIND
public event ComponentAjaxEvent.AjaxEventHandler Selected;
protected void KeySelected(object sender, AjaxEventArgs e)
{
OnSelected( e );
}
private void OnSelected(AjaxEventArgs e)
{
if (Selected != null)
{
e.ExtraParams.Add(new Parameter("Key", _Key.SelectedItem.Text));
Selected(this, e);
}
}
at the end of trip _destination should have _source.SelectedItem: if I debug it actually assign this value, but nothing happens on UI.Thank you
Stefano