Hello
I have a Webgrid inside a WARP and a WebImageButton outside it. I would like to handle the Client-Side AfterSelectChange event of the grid in such a way that if the value of the "HasPDF" cell of the selected row is 1 the button has to be enabled and disabled otherwise, having that there is single selected row (the button has to be disabled if there is not a single selected row).
Since I do not know much of CSOM, I would appreciate any coding help you can give me.
Thanks a lot.
Hi,
Try this code.
(1) Adding event handler
<ClientSideEvents
AfterRowActivateHandler="grid_AfterRowActivate" />
(2) function
function grid_AfterRowActivate(gridName,rowId)
{
var row = igtbl_getRowById(rowId);
var imgButton = ig_getWebControlById("<%= WebImageButton1.ClientID %>");
if(row.getCellFromKey("HasPDF").getValue() == 1)
imgButton.setEnabled(true);
}
else
imgButton.setEnabled(false);
I think you also need to select first row at first time load. You can handle this in Initialize layout handler event.
Let me know if this helps you.
Greetings
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { Color backColor; string strDynCnt = e.Row.Cells.FromKey("SD").Value.ToString(); if (strDynCnt == "Dynamic") { backColor = System.Drawing.Color.LemonChiffon; e.Row.Style.BackColor = backColor; e.Cancel = false; } else { e.Cancel = true; } }