Get selected Row Details

6 posts, 0 answers
  1. Rikin Patel
    Rikin Patel avatar
    13 posts
    Member since:
    Feb 2010

    Posted 13 Feb 2010 Link to this post

    How to det selected row Detail i.e i want perform row selected event in which user select row that selected row detail display in textbox so how to get details pls help me

    pls help me .............


    plsssssssssssssssssssssssssssssssssssss..........
     

    as early as possible...
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 15 Feb 2010 Link to this post

    Hi Rikin Patel,

    If your detail are shown when a row is clicked you can easily get access to the root element of the RowDetails by using RowDetailsVisibilityChanged event.For example:

        this.gridView.RowDetailsVisibilityChanged += new EventHandler<GridViewRowDetailsEventArgs>(gridView_RowDetailsVisibilityChanged);
      
      
    void gridView_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
    {
        // get the root element of the RowDetails
        var detailsElement = e.DetailsElement;
    }

    You can also get the same element by using the ItemsContainerGenerator:

    private void GetRowDetailsContent()
    {
        var selectedRow = (GridViewRow)this.gridView.ItemContainerGenerator.ContainerFromItem(this.gridView.SelectedItem);
        var detailsPresenter = selectedRow.ChildrenOfType<DetailsPresenter>().FirstOrDefault();
      
        // same as e.DetailsElement from gridView_RowDetailsVisibilityChanged
        var detailsContent = detailsPresenter.Content;
    }

    One you have the detailsPresenter you can actually search for any visual element in the RowDeails template using our ChildrenOfType method.

    Hope this helps.


    Best wishes,
    Milan
    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.
  3. Rikin Patel
    Rikin Patel avatar
    13 posts
    Member since:
    Feb 2010

    Posted 15 Feb 2010 Link to this post

    thk u milan........

    but i am new user of wpf so it is so difficut to understand ......but thk u give me rply....

    i got another solution like....

     
    DataRow row = (DataRow)radGridView1.SelectedItem;<br> 
     
    textBox1.Text = row[0].ToString(); 

    i am in 6th sem of mca and make project in WPF(C#)


  4. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 10 Mar 2011 Link to this post

    Is there another way to get the value then the index.

    It just seems problematic if you add a column then you need to adjust your index for getting the value
  5. Er Gopal
    Er Gopal avatar
    1 posts
    Member since:
    Mar 2015

    Posted 09 Mar 2015 in reply to Milan Link to this post

    Hi Milan,
      .. i had tried your code .. but there is no ....ChildrenOfType...  how i can get .... 
  6. Yoan
    Admin
    Yoan avatar
    1187 posts

    Posted 09 Mar 2015 Link to this post

    Hi,

    You need a reference to the Telerik.Windows.Controls assembly.

    As a side note - you can check the Customize the UI programmatically help article for more information about the use of ParentOfType<> and ChildrenOfType<> extension methods.

    Regards,
    Yoan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top