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

Customized controls embedded in GridView

5 Answers 161 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Blue Chen
Top achievements
Rank 1
Blue Chen asked on 06 Apr 2010, 08:50 AM

I try to embed RadCheckBoxElement to GridView in CellFormating event. My scenario is to show a RadCheckBoxElement in row "caption0". My Telerik controls version is Q1 2010.

        void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)  
        {  
            if (e.CellElement.ColumnInfo is GridViewDataColumn && ((GridViewDataColumn)e.CellElement.ColumnInfo).FieldName == "Caption")  
            {  
                if (!(e.CellElement.RowElement is GridTableHeaderRowElement))  
                {  
                    if (e.CellElement.Text.Equals("caption0"))  
                    {  
                        if (e.CellElement.RowInfo.Cells["Value"].CellElement.Children.Count > 0)  
                            return;  
                        RadCheckBoxElement element = new RadCheckBoxElement();  
                        e.CellElement.RowInfo.Cells["Value"].CellElement.Children.Add(element);  
                    }  
                }  
            }  
        }  
 

It seems that everything works fine without scrollbar.

However, if I scroll the scrollbar, a strange issue will happen. The RadCheckBoxElement will be embedded not only in row "caption0" but also in other rows. If I scroll the scrollbar several times, more and more RadCheckBoxElement will be shown in different rows.

Please refer to the attached images.

Could anybody help me? Thank you.

5 Answers, 1 is accepted

Sort by
0
Blue Chen
Top achievements
Rank 1
answered on 08 Apr 2010, 01:55 AM
Could anyone help me?
0
Svett
Telerik team
answered on 08 Apr 2010, 04:34 PM
Hi Blue Chen,

Your scenario requires the creation of custom data cell, because in CellFormatting you cannot arrange the content of the cell. You can read more about that in this documentation article which describes similar cases but with several radio buttons.

If you need further assistance feel free to contact us back.

Regards,
Svett
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
Adolfo
Top achievements
Rank 1
answered on 23 Jul 2010, 05:04 PM
Hello,

Wiht the version Q2 2009 SP1 and VS 2005 this exemple don't  work ??

Tnks
0
Svett
Telerik team
answered on 26 Jul 2010, 05:30 PM
Hi Adolfo,

We always update our online documentation and knowledge base articles to be relevant with the latest version. I recommend downloading and upgrading to the latest version Q2 2010 v713, where many issues have been addressed. You can read more about the new features and resolved issues in the latest release notes.

As to the cell formatting event for your version (Q2 2009 SP1), please review the relevant help topic in the documentation which is installed with your particular version on your machine.

 
Sincerely yours,
Svett
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
Adolfo
Top achievements
Rank 1
answered on 27 Jul 2010, 03:23 PM
Hi Svett, Thank you very much.

Adolfo Mujica
Tags
GridView
Asked by
Blue Chen
Top achievements
Rank 1
Answers by
Blue Chen
Top achievements
Rank 1
Svett
Telerik team
Adolfo
Top achievements
Rank 1
Share this question
or