When I edit a text in the text box and then press the button the text in the text box doesn't get updated , the text box doesn't lose focus on the button click...
So for example : when the form loaded the text box contains text "AAA". I click on the text box and start changing the text to "BBB", then (without diselecting the text box) I click "PRINT" button - the printed value would be "AAA" and not "BBB"
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding LabelToPrint, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Header
=
"label "
IsReadOnlyBinding
=
"{Binding IsLabelReadOnly}"
EditTriggers
=
"CellClick"
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewColumn
Header
=
"Print Label"
FocusManager.FocusedElement
=
"BagGridView"
>
<
telerik:GridViewColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadButton
Content
=
"Print Label"
Command
=
"{Binding DataContext.PrintLabelCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}, AncestorLevel=2}}"
CommandParameter
=
"{Binding}"
/>
</
DataTemplate
>
</
telerik:GridViewColumn.CellTemplate
>
</
telerik:GridViewColumn
>
7 Answers, 1 is accepted
You can try to execute the RadGridView.CommitEdit method just before printing the value.
I hope this helps.
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Unfortunately it hasn't resolved the issue
I added RadGridView.CommitEdit() on PRINT button's click, but nothing has changed. After the click the text boxed still continued to keep the focus and remains editable....
Here is a video to illustrate the issue
http://www.screenr.com/Kl57
Thanks
Indeed, you are quite right. I am afraid that this is expected behavior. However, I can suggest you to implement a functionality similar to this demo.
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I don't think it shoud be expected as a standard behaviour.When another control (button in this case) is clicked , the text box should lose the focus and commit any performed changes. The workaround we've implemented so far is to use a regular text box control inside of RAD datacolumn with PropertyChanged for UpdateSourceTrigger...
I am glad to hear that you could resolve the problem by yourself.
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
has this functionality been implemented yet or is it still a bug in the system. As pointed above, the expected behaviour should be lose focus and I was wondering that its been 6 years since an issue was reported and whether it has been incorporated in Radgrid yet?
Hello Gaurav,
The focus is not lost when you click the button because the RadGridView control was designed this way. Basically, nothing can get the focus until the currently edited cell exit the edit mode. This was implemented to avoid invalid data back to the model and therefore the validation to work properly.
To achieve the behavior asked in the original post of this reply, you can manually commit the edit when the button gets clicked. I've attached a small example showing this approach. I hope it helps.
Regards,
Martin Ivanov
Progress Telerik