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

How to get GridDataCellElement from grid

4 Answers 224 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hrachya Bekverdyan
Top achievements
Rank 1
Hrachya Bekverdyan asked on 18 Aug 2010, 01:45 PM
I have created custom cells in rad grid like this

private void radGrid_CellFormatting( object sender, CellFormattingEventArgs e )
 {
           if( e.CellElement.ColumnInfo.Name == "Rate")
            {
                CurrencyRate currencyRate = e.CellElement.RowInfo.DataBoundItem as CurrencyRate;
                RadSpinElement spin = new RadSpinElement( );
                spin.MinValue = 0;
                spin.MaxValue = decimal.MaxValue;
                spin.DecimalPlaces = 2;
                spin.TextAlignment = HorizontalAlignment.Center;
                spin.Value = currencyRate.Rate;
                e.CellElement.Children.Add( spin );              
            }
}

now, how can I get RadSpinElement object from here

private void radGrid_CommandCellClick( object sender, EventArgs e )
{
                 GridCommandCellElement cell = sender as GridCommandCellElement;
                if( cell.ColumnInfo.Name == "Update" )
                {
                        //I need "Rate" RadSpinElement object here
                 }
}

without creating custom RadSpinGridCellElement.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 23 Aug 2010, 02:39 PM
Hello Hrachya Bekverdyan,

Thank you for writing.

Actually because of grid's virtualization there is not a direct way to get the custom inserted element in a particular grid cell outside of the CellFormatting event. I recommend you to take a look at following KB Article for some hints how to implement your scenario.

Let me know if you have any additional questions.

Best wishes,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Hrachya Bekverdyan
Top achievements
Rank 1
answered on 24 Aug 2010, 03:55 PM
It was very helpful.
Thank You for reply.
0
Andy
Top achievements
Rank 1
answered on 29 Jan 2011, 01:18 AM
Hello the Telerik Team,

The article is helpful, but how do I add this custom column during design time?

Thanks,
Andy
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 29 Jan 2011, 11:23 AM
Hello Andy,

As far as I'm aware, there is no support for adding custom columns at design time. This needs to be done programatically.
Regards,
Richard
Tags
GridView
Asked by
Hrachya Bekverdyan
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Hrachya Bekverdyan
Top achievements
Rank 1
Andy
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Share this question
or