Server-Side:
In the InitializeRow event, set AllowEditing property to "AllowEditing.No" after checking the condition. In this example, updates are forbidden for cells in the fourth column if the value is already greater than 5000:
private void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
{
if ((int) e.Row.Cells[3].Value > 5000)
{
e.Row.Cells[3].AllowEditing = Infragistics.WebUI.UltraWebGrid.AllowEditing.No;
}
}
Client-Side:
Disable editing on the cell in the BeforeEnterEditMode client-side event handler by canceling the event (returning a value of "true") after checking the condition. In this example, updates are forbidden for cells that belong in the "Dept" column whose value is not "Finance":
In JavaScript:
function UltraWebGrid1_BeforeEnterEditModeHandler(gridName, cellId)
{
var c = igtbl_getCellById(cellId);
if (c.Column.Key == "Dept" && c.getValue() != "Finance")
{
return true;
}
}
Wednesday, December 3, 2008
Make a WebGrid cell read-only in certain conditions
Posted by Suryan at 11:45 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment