PDA

View Full Version : [CLOSED] How to Call an event by Direct Events



Oliver
Jun 12, 2012, 5:14 PM
Hi,

I'd like to call a direct event after leave some field. I'm doing this using the "Change OnEvent" but it is called by each caracter entered by the user and I want to call only when the field lost the focus.

Please help me to change to correct method.

My code:



<ext:TextField ID="txtUsername" runat="server" ReadOnly="false" FieldLabel="User"
AllowBlank="false" Text="" LabelAlign="Right">
<DirectEvents>
<Change OnEvent="posicionarEmpresa" />
</DirectEvents>
</ext:TextField>


Code in CS:



public void posicionarEmpresa(object sender, DirectEventArgs e)
{
var lista = from f in dc.Empresas
join x in dc.UsuarioEmpresas on f.nCdEmpresa equals x.nCdEmpresa
join u in dc.Usuarios on x.nCdUsuario equals u.nCdUsuario
where u.cNmLogin == this.txtUsername.Text
orderby f.cNmEmpresa
select new
{
f.nCdEmpresa,
f.cNmEmpresa
};

this.StoreEmpresa.DataSource = lista;
this.StoreEmpresa.DataBind();
}



Thanks in advance,

Oliver

Daniil
Jun 12, 2012, 6:21 PM
Hi,

Please use the Blur DirectEvent.

Oliver
Jun 12, 2012, 6:33 PM
Hi,

Please use the Blur DirectEvent.

Hi Daniil,

Thanks for the reply, it works!!


Oliver