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

[Solved] API support of RadGridView (silverlight)

11 Answers 337 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.
Satish J
Top achievements
Rank 1
Satish J asked on 24 Aug 2009, 08:43 AM
Is there any API in RadGridView to do the following programatically?

1) Get the cell Value by specifying the column name
2) Get the visible row Indexes
3) Select all the child rows
4) Fetch a Row given its index
5) Select a row given its index

regards,
Satish

11 Answers, 1 is accepted

Sort by
0
Satish J
Top achievements
Rank 1
answered on 24 Aug 2009, 11:52 AM
Anyone watching this post?
0
Satish J
Top achievements
Rank 1
answered on 24 Aug 2009, 05:53 PM
Hi Telerik team,

                         Iam evaluating RadGridView to replace our existing Grid, hence looking for API details. Would appreciate much if anyone can pick this thread.

Thanks,
Satish J
0
Milan
Telerik team
answered on 25 Aug 2009, 12:23 PM
Hi Satish J,

Thank you for considering our product.
Here is how you can use RadGridView's API to achieve the desired results:

For versions prior Q2:

private object GetCellValue(GridViewRow row, string columnName)  
{  
    var column = this.RadGridView1.Columns[columnName];  
    var columnIndex = this.RadGridView1.Columns.IndexOf(column);  
 
    return ((GridViewCell)row.Cells[columnIndex]).Value;  
}  
 
private GridViewRow FetchRow(int index)  
{  
    var record = this.RadGridView1.Records[index];  
 
    return (GridViewRow)this.RadGridView1.ItemsControl.ItemsGenerator.ContainerFromItem(record);  
}  
 
private void SelectRow(int index)  
{  
    var record = this.RadGridView1.Records[index];  
    this.RadGridView1.SelectedRecords.Add(record);  
}  
 
private int GetRowIndex(GridViewRow row)  
{  
    return ((DataRecord)row.Record).DataSourceIndex;  
}  
 
private void SelectAllRows()  
{  
    this.RadGridView1.SelectAll();  

With Q2 we began go eliminate the usage of records which are now deprecated and will be removed in a future major relase. With Q2 2009 we began to promote the usage of data items instead of records.

For Q2 2009 SP1:

private object GetCellValue(GridViewRow row, string columnName)  
{  
    var column = this.RadGridView1.Columns[columnName];  
    var columnIndex = this.RadGridView1.Columns.IndexOf(column);  
 
    return ((GridViewCell)row.Cells[columnIndex]).Value;  
}  
 
private GridViewRow FetchRow(int index)  
{  
    var dataItem = this.RadGridView1.Items[index];  
 
    return (GridViewRow)this.RadGridView1.ItemsControl.ItemsGenerator.ContainerFromItem(dataItem);  
}  
 
private void SelectRow(int index)  
{  
    var dataItem = this.RadGridView1.Items[index];  
    this.RadGridView1.SelectedItems.Add(dataItem);  
}  
 
private int GetRowIndex(GridViewRow row)  
{  
    return this.RadGridView1.Items.IndexOf(row.DataItem);  
}  
 
private void SelectAllRows()  
{  
    this.RadGridView1.SelectAll();  

Could you clarify some of the points that you have mentioned? For question number 2 I am not sure if  you would like to get the indices of all visible rows or an index of a specific row? And for question number 3 if child rows refers to the rows of a grid in flat scenario or to the rows of a grid in hierarchical scenario.

Once again thank for your interest in our product. Do not hesitate to write if you have further questions.

Sincerely yours,
Milan
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
Satish J
Top achievements
Rank 1
answered on 26 Aug 2009, 07:31 AM

Hi Milan,

               Thanks for your reply, much appreciated. Here are my answers:

Question 2: Im looking to fetch the indices of all the visible rows as we may hide certain rows based on conditions

Question 3: Child row refers to rows in hierarchial scenario.

 

Would be great if you could confirm the availability of the following requirements in your API as we need to finalise soon.

1) ReadOnly grid
2) Sort the grid given its column index and sort order
3) Unselect all child rows
4) Select all child rows
5) Expands the rows specified in the Array
6) Set the filterby criteria given its filter text
7) Set a filter for a column
8) Set a Groupby criteria given its groupby text
9) Set a Row Focus given its row index
10) Select the rows specified in an Array
11) Set a value for a given its Row, Column and the text
12) UnSelect all the child rowsgiven its parent row index

Many Thanks
Satish J

0
Satish J
Top achievements
Rank 1
answered on 28 Aug 2009, 07:15 AM
Anyone watching this post pls?

Thanks,
Satish J
0
Pavel Pavlov
Telerik team
answered on 28 Aug 2009, 12:06 PM
Hello Satish J,

Regarding API avalability  I have checked  and here is the status:

1) ReadOnly grid - SUPPORTED
2) Sort the grid given its column index and sort order - SUPPORTED
3) Unselect all child rows - SUPPORTED
4) Select all child rows - SUPPORTED
5) Expands the rows specified in the Array - SUPPORTED ( depending on clients scenario)
6) Set the filterby criteria given its filter text  - SUPPORTED
7) Set a filter for a column  - SUPPORTED
8) Set a Groupby criteria given its groupby text  - SUPPORTED
9) Set a Row Focus given its row index  - SUPPORTED
10) Select the rows specified in an Array  - SUPPORTED
11) Set a value for a given its Row, Column and the text  - SUPPORTED ( depending on source collection)
12) UnSelect all the child rowsgiven its parent row index  - SUPPORTED


Once you start implementing your project we will  be glad to provide any help needed. Do not hesitate to open a support ticket if you find any troubles implementing the above functionality .

Regards,
Pavel Pavlov
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.
0
Satish J
Top achievements
Rank 1
answered on 08 Sep 2009, 07:58 AM

Hi Pavel Pavlov,

 

                         Thanks for the prompt response. We are close to finalising the Grid. We also got the following additional requirements. Please let me know if these are achievable using your API.

 

1) Get only the visible row indexes
2) Set an Image for a column
3) ShowHeaderExpander
4) Hide a column
5) GetColumn count of only visible columns
6) Hierarchial grid column resize should be reflected on to child rows


Thanks,
Satish J

0
Pavel Pavlov
Telerik team
answered on 08 Sep 2009, 09:20 AM

Hi Satish J,

Here is the updated list :

1) Get only the visible row indexes - Not Supported internally but ACHIEVABLE via few lines of codebehind.
2) Set an Image for a column - SUPPORTED
3) ShowHeaderExpander - please give more details on this so I can check ...
4) Hide a column - SUPPORTED
5) GetColumn count of only visible columns - SUPPORTED
6) Hierarchial grid column resize should be reflected on to child rows - depending on the scenario, possibly may be ACHIEVABLE via external code.

Again , thank you for  evaluating our controls!

If you find any troubles implementing any of the features mentioned, do not hesitate to contact me . I will gladly provide you assistance by preparing an example or providing a piece of code ready to be pasted into your project. 

Sincerely yours,

Pavel Pavlov
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.
0
Satish J
Top achievements
Rank 1
answered on 17 Sep 2009, 10:43 AM
Hi Pavel Pavlov,

                          Thanks much appreciated. Can you also confirm these 2 requirements. It seems to have been missed out in the previous list:

1) Get the Child Column Index, given its Name and the row's level (like 2 for 2 levels nested in case of a hierarchial grid).
2) Get the child row count given a row index.

Thanks,
Satish J
0
Pavel Pavlov
Telerik team
answered on 18 Sep 2009, 01:17 PM
Hello Satish J,

1) Get the Child Column Index, given its Name and the row's level (like 2 for 2 levels nested in case of a hierarchial grid).- Supported  with  a few lines of external code *
2) Get the child row count given a row index.- Supported  with  a few lines of external code*

*   Please have in mind that  "row index " is kind of vague term.
Rows in RadGridView are dynamically created and virtualized. This means that only rows that are visible are currently created. The UI virtualization technique applied gives a lots of performance benefits and memory savings. 

Greetings,
Pavel Pavlov
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.
0
Prakash
Top achievements
Rank 1
answered on 25 Oct 2010, 03:31 PM
Please get me samples regarding the API's

Especaily with Hirerchical Grid API

Like Child Row count, Column Index, Row index which ever i select irrespective of Level (Hirerchical)

If possible i have attached image of my requirement... could u please visit .. and provide me the sample
Tags
GridView
Asked by
Satish J
Top achievements
Rank 1
Answers by
Satish J
Top achievements
Rank 1
Satish J
Top achievements
Rank 1
Milan
Telerik team
Pavel Pavlov
Telerik team
Prakash
Top achievements
Rank 1
Share this question
or