Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
535
tabing with ultrawebgrid checkbox column
posted

Hi,

I have ultrawebgrid with all readonly columns except checkbox column which is of type 'Checkbox'. This is an unbound editable column. I did this by doing AllowUpdate = yes in initialize layout event. I have issues with tabbing into ultrawebgrid. My asp.net page has many input controls before and after grid. When i tab thru, grid is skipped and goes to the control after grid. After googling a lot, found that grid it self doesn't get focus or tabing doesn't work. So, What I did is:

I added 'on blur' event to the control that is previous to grid and setting active cell like this:

protected void Page_Load(object sender, EventArgs e)

{

txtDesc.Attributes.Add("onBlur", string.Format("SetActiveCell('{0}');", ultrawebgrid1.ClientID));

}

 

 

 

 

on aspx page, I have a function that sets active cell like this:

 

function SetActiveCell(gridId)

{

    var grid = igtbl_getGridById(gridId);

    var cell = grid.Rows.getRow(0).getCellFromKey("chkBoxAccounts");

    grid.setActiveCell(cell);

}

 

Further, to leave all read only cells and go thru only editable cells, I got code like this:

function OnUwgKeyDown(gn,cellId,KeyStroke)

{

            // Tab Key

   if (KeyStroke == 9)

   {

     SelectNextCell(gn);

     return true;

   }

}

 

function SelectNextCell(gridClientId)

{

  var grid = igtbl_getGridById(gridClientId);

  var cell = grid.getActiveCell();

           

  if(cell != undefined && cell != null)

  {

      var nextCell = cell.getNextTabCell();

      while(nextCell != undefined && nextCell.isEditable() == false)

       {

         nextCell = nextCell.getNextTabCell();

       }

       if(nextCell != undefined)

       {

          cell.setSelected(false);

          nextCell.activate();

          nextCell.setSelected(true);

       }

  }

}

So, now I am able to tab thru regular text box control to grid and thru the rows in the grid. But after reaching the last row - cell (editable cell), when I tab, it is supposed to leave grid and go the next control on the page. That is not happening. I am not sure how to do that. Further, if grid has regular checkbox column and another templated column, I am not sure how to handle it.

I appreciate your response.

Thanks,

Prathiba. 

 

 

 

Parents
No Data
Reply
  • 8160
    posted

    Hi Prathiba,

    try to set Active Cell for the grid, so the grid knows what item to focus on it. Please handle the DataBound event for the grid and do the following in the handler:

    void UltraWebGrid1_DataBound(object sender, EventArgs e)

    {


    if (this.UltraWebGrid1.DisplayLayout.ActiveCell == null && this.UltraWebGrid1.Rows.Count > 0)


    {


    this.UltraWebGrid1.DisplayLayout.ActiveCell = this.UltraWebGrid1.Rows[0].Cells[0];


    }


    }

    after that you should be able to navigate with Tab, and Shift + Tab

Children
No Data