Pick up the single column single row value to a textbox.

Discussion in 'Questions (Windows Mobile)' started by mozaharul, May 6, 2008.

  1. mozaharul

    mozaharul Active Member Licensed User

    I have a single column single row table and want to pick up the column value to a textbox by clicking on it. I failed to do the same. If I add another column, select the second column value first and then the first column value then it works. Please help.

  2. klaus

    klaus Expert Licensed User

    In your case, the only cell you have is selected by default.
    Clicking on an already selected cell does not trigger the Table1_SelectionChanged event.

    Even in your example with the 2 columns, if you click on the first cell nothing happens.
    If you really need to display the content of this only cell in the TextBox you must do it with an extra code line during initialization of the table.

    To show this you can add in your test code at the end of the App_Start routine.
    nothing happens.

    If you change it to
    the Table1_SelectionChanged is triggerd
    and the second cell content is transfered.

    Best regards
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. willisgt

    willisgt Active Member Licensed User

    As an alternative - you could create a second column of width zero (hidden). When the table is created, set one of the cells in the zero-width column as the selected cell. In the SelectionChanged routine, you should also set the selected cell to the zero-width cell on the same row. This ensures that no matter what cell you click on, the SelectionChanged event gets raised.

    Make sense?

  5. mozaharul

    mozaharul Active Member Licensed User

    Thank you all. I opted the willisgt's solution.

    Best regards,
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice