Cell's ActivateEdit causing JS exception when cell isn't in scrolling window within WebGrid

4 replies. Last post: December 8, 2010 9:54 PM by Handy Surya
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Shawn AugustMember

I have a common method that is used to SELECT a row and ACTIVATEEDIT on a specified field. This code works fine when the cell that is specified is viewable within the WebGrid's scrollable window. For example, if a horizontal scrollbar occurs and this code is execute, the ActivateEdit generates an exception:

Invalid argument

function WebGrid_SelectRow(gridID, row, fieldName)
{
    try 
    { 
        if (IsNullOrEmpty(gridID) == true) { return; }
        if (row == null) { return; }

        // Select Row
        // NOTE: Ensure more data is not loaded causing unnecessary postback
        var grid = WebGrid_GetGrid(gridID);
        if (grid == null) { return; }
        var haltLoadMore = grid.HaltLoadMore;
        grid.HaltLoadMore = true;
        row.Select();
        
        // ActivateEdit on specified field
        if (IsNullOrEmpty(fieldName) == false) 
        {
            var cells = row.GetCells();
            if (cells != null) 
            {
                var field = cells.GetNamedItem(fieldName);
                if (field != null) { field.ActivateEdit(); }
            }                
        }            
        
        grid.HaltLoadMore = haltLoadMore;
    }
    catch (ex) { ShowJSException(ex); }
}
All times are GMT -5. The time now is 12:41 AM.
Previous Next