Hi guys,
I have a grid which allows filtering by columns. I need the filter to perform a postback after a filter has been applied. Is there any way to do it?
I have tried using AutoPostBackOnFilter="true", but it performs the postback before the filter has been applied in the client. The reason for which I need this is to enable or disable some radbuttons depending on the results of the filter; for example, if there are no rows once the filter has been applied, I want to disable the 'Edit' radbutton.
I have tried to do it client side, using the onGridCreated event:
var usuarioEsSupervisor;
function afterGridCreation() {
// Called from onGridCreated
// Mostrar el número de registros que hay en el grid
var grid = $find("<%= gridIncidencias.ClientID %>");
var MasterTable = grid.get_masterTableView();
var Rows = MasterTable.get_dataItems();
var filas = Rows.length;
var etiqueta = $get("<%=lblNumberOfIssues.ClientID %>");
etiqueta.innerHTML = filas;
// Desactivar los botones de eliminar y editar si el grid no contiene registros
var botonDelete = $find("<%=btnDeleteIssue.ClientID %>");
var botonDetails = $find("<%=btnEditIssue.ClientID %>");
if (filas > 0) {
if (usuarioEsSupervisor) {
botonDelete.set_enabled(true);
}
botonDetails.set_enabled(true);
}
}
However, for some reason that I dont know, the vars botonDelete and botonDetails get null value and, therefore, I cannot reach the buttons.
Any idea please? Thank you.
I have a grid which allows filtering by columns. I need the filter to perform a postback after a filter has been applied. Is there any way to do it?
I have tried using AutoPostBackOnFilter="true", but it performs the postback before the filter has been applied in the client. The reason for which I need this is to enable or disable some radbuttons depending on the results of the filter; for example, if there are no rows once the filter has been applied, I want to disable the 'Edit' radbutton.
I have tried to do it client side, using the onGridCreated event:
var usuarioEsSupervisor;
function afterGridCreation() {
// Called from onGridCreated
// Mostrar el número de registros que hay en el grid
var grid = $find("<%= gridIncidencias.ClientID %>");
var MasterTable = grid.get_masterTableView();
var Rows = MasterTable.get_dataItems();
var filas = Rows.length;
var etiqueta = $get("<%=lblNumberOfIssues.ClientID %>");
etiqueta.innerHTML = filas;
// Desactivar los botones de eliminar y editar si el grid no contiene registros
var botonDelete = $find("<%=btnDeleteIssue.ClientID %>");
var botonDetails = $find("<%=btnEditIssue.ClientID %>");
if (filas > 0) {
if (usuarioEsSupervisor) {
botonDelete.set_enabled(true);
}
botonDetails.set_enabled(true);
}
}
However, for some reason that I dont know, the vars botonDelete and botonDetails get null value and, therefore, I cannot reach the buttons.
Any idea please? Thank you.