May 29, 2012, 1:28 AM
[CLOSED] Update TextField by Ajax Combobox
Hello!
I have a combobox with an ajax event and I want to update the value of a textfield. I do the same thing with another combobox and works fine, but I don´t Know how to call the right event in the textfield.
Combobox Code:
Plese, help me to include the listenner in the textfield.
Thanks in advance,
Oliver
I have a combobox with an ajax event and I want to update the value of a textfield. I do the same thing with another combobox and works fine, but I don´t Know how to call the right event in the textfield.
Combobox Code:
<ext:ComboBox ID="dbIdTerceiro" runat="server" Editable="true" Height="20px" FieldLabel="Terceiro"
Width="500" ReadOnly="false" AnchorHorizontal="95%" LabelAlign="Right" QueryMode="Local"
DisplayField="cNmTerceiro" ValueField="nCdTerceiro" TriggerAction="Query" EmptyText="Selecionar..."
TypeAhead="true" ForceSelection="true">
<Listeners>
<Select Handler="#{dbIdTerceiroPagador}.clearValue(); #{StoreTerceiroPagador}.reload(); #{dbContato}.clearValue(); " />
</Listeners>
<Store>
<ext:Store ID="StoreTerceiro" runat="server" AutoLoad="true">
<Model>
<ext:Model ID="Model4" IDProperty="nCdTerceiro" runat="server">
<Fields>
<ext:ModelField Name="nCdTerceiro" Type="Int" />
<ext:ModelField Name="cNmTerceiro" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
Textfield code that I need to be updated by the selection on the combobox. I need to call a DirectEvent to fill the field when the combobox "dbIdTerceiro" is changed:
<ext:TextField ID="dbContato" runat="server" FieldLabel="Contato" AllowBlank="false"
Width="400px" LabelAlign="Right" ReadOnly="false" EmptyText="Informe o nome e telefone">
</ext:TextField>
protected void posicionarContato(object sender, DirectEvent e)
{
if (this.dbIdTerceiro.SelectedItem.Value != "")
{
Terceiro objTerceiro = dc.Terceiros.FirstOrDefault(t1 => t1.nCdTerceiro == Convert.ToInt32(this.dbIdTerceiro.SelectedItem.Value));
this.dbContato.Text = ((objTerceiro.cNmContato == null) ? "" : objTerceiro.cNmContato) + ((objTerceiro.cTelefone1 == null) ? "" : objTerceiro.cTelefone1);
}
}
Plese, help me to include the listenner in the textfield.
Thanks in advance,
Oliver
Last edited by Daniil; May 30, 2012 at 11:28 AM.
Reason: [CLOSED]