Help ! RadGridView CellTemplate ChildrenOfType not running :-(

5 posts, 0 answers
  1. EBIS EBIS
    EBIS EBIS avatar
    3 posts
    Member since:
    Apr 2010

    Posted 01 Jan 2012 Link to this post

    Hi.I'am using Vs2010 and silverlight 5 and Telerik RadControls for Silverlight Q3 2011.
    I downloaded  "01744RadControls_for_Silverlight5_2011_3_1227_DEV_hotfix"
    When I search a control in the radgridview celltemplate but I can't see it.
    like "cell.ChildrenOfType<RadButton>"
    Please help

    <telerik:GridViewColumn UniqueName="ButtonColumn">

                        <telerik:GridViewColumn.CellTemplate>

                            <DataTemplate>

                                <telerik:RadButton Content="Başlat" Name="button1" Tag="{Binding}"  Click=" button1"/>

                            </DataTemplate>

                        </telerik:GridViewColumn.CellTemplate>

     </telerik:GridViewColumn>

    private void RadGridView1_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)

     {

                    var cell = e.Row.Cells.FirstOrDefault(c => c.Column.UniqueName == "ButtonColumn");

                if (cell != null)

                {

                    var button = cell.ChildrenOfType<RadButton>().FirstOrDefault();

                }

     }

    when I debuged button is null :-(


  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 02 Jan 2012 Link to this post

    Hi,

    I am not sure what is the final goal you are trying to achieve but you may try the following - subscribe to the loaded event to the button itself and execute your relevant code in the handler of the Loaded event of the button.

    In case this is not applicable , please share some more info on what you are trying to achieve so we can find the best solution for your specific scenario.

    All the best,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. EBIS EBIS
    EBIS EBIS avatar
    3 posts
    Member since:
    Apr 2010

    Posted 02 Jan 2012 Link to this post

    thank you,
     it is no ok.
  4. EBIS EBIS
    EBIS EBIS avatar
    3 posts
    Member since:
    Apr 2010

    Posted 03 Dec 2012 Link to this post

    I'm sorry, No it is not.

    My purpose is, inserting Button to RadGridView Row in runtime.It just;


    private void AddColumnToGrid(){
                  GridViewColumn clmn = new GridViewColumn();
                    TelerikDataGrid.Columns.Insert(0, clmn);
    }


    public void TelerikDataGrid_RowLoaded(object sender, RowLoadedEventArgs e)
            {

    if (!e.Row.GetType().Equals(typeof(GridViewHeaderRow)) && !e.Row.GetType().Equals(typeof(GridViewFooterRow)))
      {
                     StackPanel sb = new StackPanel();
                      sb.Orientation = Orientation.Horizontal;

                      RadButton btnEdit = null;
                      btnEdit = new RadButton();
                      btnEdit.Content = "Detail";
                      btnEdit.Click += new RoutedEventHandler(btnEdit_Click);
                      sb.Children.Add(btnEdit);

                           if (e.Row.Cells!=null&&e.Row.Cells.Count > 0)
                            {
                                e.Row.Cells[0].Content = sb;
                            }
      }
                     

    }



    btnEdit Button is not show in the Row :-(



  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Dec 2012 Link to this post

    Hello,

    According to your reply almost a year ago the solution worked. Can you post more info what is changed?

    Kind regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top