Hi:
I have a problem when launching a AsyncPostBack Trigger programmatically. I mean...
I have an UpdatePanel with an AsyncPostBackTrigger like this: <asp:AsyncPostBackTrigger ControlId="btnFilter" EventName="Click" />
If I click on the button, the server code executes and the Update Panel refresh properly. But, when I click the button programmatically in a javascript method like this: $get('btnFilter').click, the server code runs perfectly, but the Update Panel doesn't refresh. The page is not Posted enterely, so the UpdatePanel works fine trying to refresh only himself, but the content, as I said before, doesn't refresh.
I've also tried to include the button and the textbox (search criteria) inside the content panel, with the Children as trigger set to True and removing the AsyncPostBackTrigger, but it still happens the same.
I have a seach textbox and a filter button on a page, and the update panel in a User Control. What I like to do is to refresh the Grid that is inside the Update Panel when clicking the filter button. On previously versions I used this method of refreshing the panel, but now it doesn't work... any suggestion?
This is the code:
Page1.aspx
function Buscar() {
$get(controlfiltro).value = $get('MainContent_txtNombreCliente').value;
$get(botonfiltro).click();
$get('divBusqueda').style.display = '';
}
function CerrarBusquedaNuevaSimulacion() {
$get'divBusqueda').style.display = 'none';
}
var controlfiltro = 'MainContent_ResultadoClientes1_txtFiltro';
var botonfiltro = 'MainContent_ResultadoClientes1_btnFiltrar';
<table border="0" cellpadding="0" cellspacing="0" style="margin: left; line-height: 20px;
width: 100%">
<tr>
<td style="height: 5px">
</td>
</tr>
<tr>
<td align="right" valign="middle">
<asp:Literal runat="server"ID="lblNombreCliente" Text="Name:" />
</td>
<td valign="middle">
<asp:TextBox ID="txtNombreCliente"runat="server" CssClass="FormObligatorio" Width="200px"
Text="Nombre Cliente" />
</td>
<td align="left">
<img id="lupa" src="../img/lupa.gif"alt="Buscar" title="Buscar" style="height: 20px;
vertical-align: middle; cursor: hand;" onclick="javascript:Buscar()" />
</td>
</tr>
</table>
ResultadoClientes.ascx
<%@ Control Language="VB" AutoEventWireup="false"CodeFile="ResultadoClientes.ascx.vb"
Inherits="Simulador_WebUserControl" %>
<%@ Register Assembly="Infragistics4.Web.v14.1, Version=14.1.20141.2150, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<div style="margin-left: 40px; margin-top: 40px; vertical-align: middle;">
<asp:UpdatePanel ID="updatePanel1" runat="server" ChildrenAsTriggers="False"UpdateMode="Conditional">
<ContentTemplate>
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="260px"Width="505px" AutoGenerateColumns="False"
DataKeyFields="ClienteId" EnableAjax="True"EnableAjaxViewState="True">
<Columns>
<ig:BoundDataField DataFieldName="ClienteId"DataType="System.String" Key="ClienteId"
Width="75">
<Header Text="Id Cliente" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="NombreCliente"DataType="System.String" Key="NombreCliente"
Width="200">
<Header Text="Nombre Cliente" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="NombreGrupo"DataType="System.String" Key="NombreGrupo"
Width="200">
<Header Text="Nombre Grupo" />
</ig:BoundDataField>
</Columns>
<AjaxIndicator ImageUrl="~/img/Cargando.gif" Enabled="True" />
<Behaviors>
<ig:Selection CellClickAction="Row" RowSelectType="Single">
</ig:Selection>
<ig:Paging NextPageText="Siguientes 10&nbsp;&gt;"PageIndex="0" PageSize="10"
PagerMode="NextPrevious"PreviousPageText="&lt;&nbsp;Anteriores 10">
</ig:Paging>
</Behaviors>
</ig:WebDataGrid>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnFiltrar" EventName="Click"/>
</Triggers>
</asp:UpdatePanel>
<br />
<div style="text-align: right">
<input type="button" class="Boton" id="btnCerrar" runat="server"value="Cerrar" />
<input type="button" class="Boton" id="btnSeleccionar" runat="server"value="Seleccionar" />
</div>
<div style="">
<asp:Button ID="btnFiltrar" runat="server" UseSubmitBehavior="true"Text="buscar" />
<asp:TextBox ID="txtFiltro" runat="server" />
</div>
<br />
Server Code onResultadoClientes.ascx
Protected Sub btnFiltrar_Click(sender As Object, e As System.EventArgs) HandlesbtnFiltrar.Click
Me.WebDataGrid1.DataSource = CrearDatos(Me.txtFiltro.Text)
Me.WebDataGrid1.DataBind()
End Sub
Regards