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

[Solved] click event for selecting a column in a cell of telerik rad grid in silver light

3 Answers 185 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bala subramanian
Top achievements
Rank 1
Bala subramanian asked on 04 Jul 2009, 05:39 AM
 <telerikGrid:RadGridView x:Name="rgvCustName" Grid.Row="1" Grid.Column="0" AutoGenerateColumns="False" ShowGroupPanel="false" UseAlternateRowStyle="True" RowLoaded="rgvCustName_RowLoaded">
            
            <telerikGrid:RadGridView.Columns>
                <telerikGrid:GridViewDataColumn HeaderText="Edit" Width="40" UniqueName="Edit" IsReadOnly="False"/>
                <telerikGrid:GridViewDataColumn HeaderText="Delete" Width="50" UniqueName="Delete" />
                <telerikGrid:GridViewDataColumn HeaderText="Default" Width="80" UniqueName="DefaultName" />
                <telerikGrid:GridViewDataColumn HeaderText="Name Type" Width="100" UniqueName="NameType" />
                <telerikGrid:GridViewDataColumn HeaderText="Display Name" Width="200" UniqueName="CompleteName" />
                <telerikGrid:GridViewDataColumn HeaderText="Last Name" Width="200" UniqueName="LastName" />
                <telerikGrid:GridViewDataColumn HeaderText="First Name" Width="200" UniqueName="FirstName" />
                <telerikGrid:GridViewDataColumn HeaderText="Middle Name" Width="100" UniqueName="MiddleName" />             
            </telerikGrid:RadGridView.Columns>
        </telerikGrid:RadGridView>       

i have written a code like this in XAML file..
i need to get an alert if i click a delete button in each cell of the the grid in the delete column. Is there any events in telerik Radgrid for silver light
plz help me asap.
Regards
Bala

3 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 06 Jul 2009, 05:46 AM
Hi,

You can putt a button in your delete column and handle the button click event.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
NickZ
Top achievements
Rank 1
answered on 23 Jul 2009, 09:05 PM
Hi Vlad,

Do you have any code samples about adding a button column with button click event?  Here is my code:

 

 

            column = new GridViewDataColumn();  
            column.HeaderText = "Select";  
            column.UniqueName = "Select";  
            column.HeaderTextAlignment = TextAlignment.Center;  
            // add a button column with click event on each one   
            ProjectList.Columns.Add(column);  
                  
 
 

 

 


Thanks a lot,
Nick
0
Vlad
Telerik team
answered on 27 Jul 2009, 07:17 AM
Hi NickZ,

The easiest way to achieve this is to create your own column and override CreateCellElement():

            MyGridViewDataColumn column = new MyGridViewDataColumn();
            column.UniqueName = "Name";
            RadGridView1.Columns.Add(column);

    public class MyGridViewDataColumn : GridViewDataColumn
    {
        public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
        {
            Button btn = new Button();
            btn.Click += new RoutedEventHandler(btn_Click);
            return btn;
        }

        void btn_Click(object sender, RoutedEventArgs e)
        {
            throw new NotImplementedException();
        }
    }

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Bala subramanian
Top achievements
Rank 1
Answers by
Vlad
Telerik team
NickZ
Top achievements
Rank 1
Share this question
or