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

[Solved] grid View newly inserted row selection

1 Answer 72 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.
smith
Top achievements
Rank 1
smith asked on 05 Oct 2009, 03:26 PM
HI

 I am binding the gridview. using Observable collection. i provided one button outside the gridview called Add.
now i click the add button it wiill create the New row in gridview,
now my problem is i want to slect the first column of the last added row. in this gridview there is  no rows available.
gridview.rows[7].cells[1].isselected = true

like that i need to do

How to get this functioanality here .
pls send example code for this one .

thanks in advance.
murugan

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 07 Oct 2009, 06:44 AM
Hello smith,

You can get rows like this:
private void Button_Click(object sender, RoutedEventArgs e)  
{  
    var row = gridView.ItemsControl.ItemsGenerator.GenerateItemAtIndex(0) as GridViewRow;  
    if (row != null)  
    {  
        row.IsSelected = true;  
        GridViewCell cell = row.Cells[0] as GridViewCell;  
        if (cell != null)  
        {  
            cell.IsCurrent = true;  
        }  
    }  

I should let you know that we will change this in our Q3 release.
Let us know if you need more help.

Best wishes,
Hristo
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.
Tags
GridView
Asked by
smith
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or