This is a migrated thread and some comments may be shown as answers.

Problem - Row validating with Custom column

0 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michel Loubier
Top achievements
Rank 1
Michel Loubier asked on 06 Dec 2012, 07:42 PM
Hi,

We created a custom column (based on GridViewBoundColumnBase using the CreateCell* methods to create the various controls) to display a TextBox and a RadButton.  The purpose of the button is to show a modal window to display the content of the TextBox (because our TextBox cannot not accept multilines).

 Here an example of what we're doing:

|    SSN       |  Another column  | My Custom column |
--------------------------------------------------------------
|                  |                             |  *Text Box*   |Button|   <----- New Row
--------------------------------------------------------------
| 111111111 |                             |  *Text Box*   |Button|
--------------------------------------------------------------

There is a validation on the mandatory SSN column.


First implementation
Both the Cell and cell edit template define the button with IsEnabled = true.

  • When we click on the button on row #2, the Click Event of the button is triggerred (showing our modal window).  Then, the row validating of the first row is fired.  This leaves us in a bizarre situation where our modal shows info from the second row while the grid marks the first row with validation errors.

Second implementation
The button in the Cell Template is IsEnabled = False and the one in the CellEdit is IsEnabled=true.

In this scenario, when we click on the disabled button on row #2, the validation of row #1 is triggered.  The focus on row #2 is set only when row #1 is valid. 

However, on row #2 when the Cell Edit template is shown, the focus is set to the first control (Textbox)...

In the second approach, there are 2 problems: 1 - The "click" is not sent to the "Cell Edit" button AND 2 - the "Cell" button is disabled (at first, the user thinks that the button is not accessible.

--------------------------------------------

With that in mind, is there a way to this :

  • In the first implementation, is there a way to trigger Validation of the first row within our Custom column and giving back the focus on row #1;
  • In the second implementation, is there a way to visually make the the RadButton looks like an Enabled button event when disabled AND is there a way to catch the click on the disabled button and to trigger it on the enabled button;
  • A new and better implementation ;-)

Thanks.
-----------------------------------------------------

Using version: 2012.2.607.35 with WPF

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Michel Loubier
Top achievements
Rank 1
Share this question
or