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

Radwatermark text box loaded event issue on RadGridview

3 Answers 28 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bhakti
Top achievements
Rank 1
Bhakti asked on 01 Mar 2012, 06:19 PM
We are using Q1 2011  SP1 telerik version. 
There is a radwatermark textbox used in a radgridview. The loaded event is not firing on double clicking the text box in the gridview.
The same functionality works with Telerik version 2010 Q3.
We are not planning to use latest 2012 telerik version due to some animation issues for our application.
Please suggest any quick solution at the earliest.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 02 Mar 2012, 02:16 PM
Hi,

 Can you clarify where you've placed this RadWatermarkTextBox?

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bhakti
Top achievements
Rank 1
answered on 02 Mar 2012, 04:19 PM

XAML ------
<
telerik:GridViewDataColumn.CellEditTemplate>

                                <DataTemplate>

                                    <Border>

                                        <telerik:RadWatermarkTextBox

                                            Text="{Binding FieldValue, Mode=TwoWay,

                                                Converter={StaticResource  DataFieldValidationValueConverter}}"

                                            Loaded="Editor_Loaded"

                                            />

                                    </Border>

                                </DataTemplate>

                            </telerik:GridViewDataColumn.CellEditTemplate>

Event Code ---------------

     private void Editor_Loaded(object sender, RoutedEventArgs e)

        {

           

    // Get the control.

            Control ctrl = sender as Control;

            if (ctrl != null)

            {

                // Set the cursor position.

                RadWatermarkTextBox txt = (RadWatermarkTextBox)sender;

                if (txt.Tag.Equals("FieldValue"))

                {

                    (sender as RadWatermarkTextBox).SelectionStart = (e.OriginalSource as RadWatermarkTextBox).Text.Length;

                    if ((e.OriginalSource as RadWatermarkTextBox).Text.Equals("0"))

                    {

                        (sender as RadWatermarkTextBox).Text = String.Empty;

                    }

                }

                ctrl.Focus();

            }

        }

0
Vlad
Telerik team
answered on 06 Mar 2012, 10:54 AM
Hi,

I'm not sure what is the problem at your end however I've tried Loaded event of RadWatermarkTextBox declared in CellEditTemplate of a grid column and everything worked perfectly well. You can check the attached project for reference. 

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Bhakti
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Bhakti
Top achievements
Rank 1
Share this question
or