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

How to work with Filtered Row?

2 Answers 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shalabh
Top achievements
Rank 1
Shalabh asked on 07 Jan 2011, 07:14 PM
I am using RadGrid and using Filter By Column functionality. My grid displays Products and Details (including pricing) after loading the Order Guide. Pricing calculation takes time so we calculate price while change the page (of RadGrid). After loading Order Guide if I want to see particular product by filter then grid shows the row but not the pricing of the item because after filter there have no code written to calculate price for filtered Row. How can I work with the Filtered Row (at which event I can get the filtered row before it displays or get loaded)? (Please refer the attached snapshot)

 

2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 13 Jan 2011, 08:50 AM
Hello Shalabh,

You need to use RadGrid's ItemDataBound event. This event will fire for each item in RadGrid after databinding. This means that all grid commands (page, sort, filter) that cause a rebind will be handled appropriately. Inside the event handler, you can calculate the price for each data item:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if(e.Item is GridDataItem)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        //calculate price here
    }
}


Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Shalabh
Top achievements
Rank 1
answered on 13 Jan 2011, 06:13 PM
Thank you very much for the response. I know about ItemDataBound and I have already implemented it, but I did not put the price calculation logic within this event because of performance issues. I managed to solve my problem using Prerender event of page. Thank you very much for giving your precious time to look into my issue.
Tags
General Discussions
Asked by
Shalabh
Top achievements
Rank 1
Answers by
Veli
Telerik team
Shalabh
Top achievements
Rank 1
Share this question
or