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
219
Set ative cell in xmaWebGrid
posted

Hello,

I will set the active cell with following program code:

    private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
    {
      dg.Rows[0].Cells[1].IsActive = true;
    }

And I become a NullReferenceException. With the debugger I can see this cell with data.

Following program code with another row works correct:

    private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
    {
      dg.Rows[1].Cells[0].IsActive = true;
    }

Can you help me, please.

Parents
  • 40030
    Suggested Answer
    Offline posted

    Hi, 

    I'd recommend using the Key of your column to make sure you're targeting the correct column.  

    dg.Rows[0].Cells["MyColumn"].IsActive = true;

    I noticed that your second line of code, uses a different cell, which could mean that maybe Cells[1] is a hidden column, or maybe you only have one column.  It's always safer to use the Column keys, as it ensure you're working with the column you intended. 

    Hope this helps, 

    -SteveZ

Reply Children