Greetings,
I am currently using version control RadAjaxManager 2010.3.1109.35 with the following problem:
I want to update a particular "asp: DropDownList" when the values of a "Telerik:RadMaskedTextBox" changed.
For this purpose i’m using the client event "OnValueChanged" to trigger a Ajax request, however, this scenario only works one time.
After the first ajax request, if i trigger the "OnValueChanged" again, the ajax request isn’t fired. I have done some debug and in the second time i trigger the event, the control RadAjaxManager in the client side is null.
How do I solve this problem?
Code executed in server side:
protected void Adabas_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) { string argument = (e.Argument); string[] arrayString = argument.Split(",".ToCharArray()); string operacao = arrayString[0]; if (operacao == "CarregarADABAS") { ptin.formare.lms.core.utilizadores.cnpj.gestaoCNPJ _gestcnpj = new ptin.formare.lms.core.utilizadores.cnpj.gestaoCNPJ("LMS_BD"); DataTable lista_ADABAS = _gestcnpj.ListaADABASPorCNPJ(arrayString[1]); ddAdabas.Items.Clear(); ddAdabas.DataSource = lista_ADABAS; ddAdabas.DataTextField = "ADABAS"; ddAdabas.DataValueField = "ADABAS"; ddAdabas.DataBind(); } } Code executed in cliente side:
<telerik:RadAjaxManager ID="Adabas" runat="server" onajaxrequest="Adabas_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="Adabas"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="ddAdabas" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function CarregaListaADABAS (sender, args) { var message = args.get_newValue(); message = message.replace(/[^a-zA-Z 0-9]+/g,''); var ajaxManager = $find("<%= Adabas.ClientID %>"); //This value is null in the second time (event OnValueChanged) if(ajaxManager != null) { ajaxManager.ajaxRequest('CarregarADABAS,'+ message); } } </script > </telerik:RadCodeBlock> <Telerik:RadMaskedTextBox ID="txt_cnpj" runat="server" Rows="1" UseEmbeddedScripts="False" Mask="##.###.###/####-##" TextWithLiterals="..-" CausesValidation="True" Width="125px" Height="11px" Skin="Outlook"> <ClientEvents OnValueChanged="CarregaListaADABAS"/> </Telerik:RadMaskedTextBox>
Regards