Contact Sales: +1-888-365-2779
Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > GridView > Select Row

Not answered Select Row

Feed from this thread
  • Posted on Jan 7, 2010 (permalink)

    Hello

    I want to let the user find a row by the value of a specific column
    this is the scenario-
    the user write a text in a TextBox
    and click search
    then I take the text and find the row
    (((System.Data.DataView)RadGridView1.ItemsSource).Table.Select("ActivityName like '%" + txtSearch.Text + "%' ")[0]) 
    now I want to select this row
    how can I do it?

    Reply

  • Milan Milan admin's avatar

    Posted on Jan 7, 2010 (permalink)

    Hi Orit,

    Once you have found the data item you just need to set it as SelectedItem and it will be selected. For example:

    var itemToSelect = (((System.Data.DataView)RadGridView1.ItemsSource).Table.Select("ActivityName like '%" + txtSearch.Text + "%' ")[0]);
    this.myGrid.SelectedItem = itemToSelect;


    Sincerely yours,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Q1 Webinar Week
  • Posted on Jan 7, 2010 (permalink)

    I tried it
    but it does not work
    the SelectedItem is null.

    Reply

  • Milan Milan admin's avatar

    Posted on Jan 7, 2010 (permalink)

    Hi Orit,

    I guess that either the itemToSelect is null or it is not present in the ItemsSource that the grid is bound to. Since you are using a DataView I guess the grid is bound to a list of DataRowView items. If that is the case you will need to find the corresponding DataRowView (the Select method return a DataRow) item and set this item as SelectedItem. 


    Kind regards,
    Milan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > GridView > Select Row
Related resources for "Select Row"

WPF Grid Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]