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

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.


regards,
 

klaus

Expert
Licensed User
Longtime 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.
table1.SelectCell("Column1",0)
nothing happens.

If you change it to
table1.SelectCell("Column2",0)
the Table1_SelectionChanged is triggerd
and the second cell content is transfered.

Best regards
 

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?

Gary
 
Top