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

Removing radgrid record on item databound

4 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 26 Apr 2012, 03:38 PM
Hi,

I have a radgrid that I want to remove some items  based on data on item databound. There were several computation happening on serveral columns in item databound. If the computed value of that record is equal to zero, it should no longer show. Any info on how can I accomplish this one..

Thanks in advance,
RJ

4 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 26 Apr 2012, 08:00 PM
Hello RJ,

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = e.Item as GridDataItem;
                 
                //using datakey
                if (item.GetDataKeyValue("ID").ToString() == "1")
                {
                    item.Display = false;
                }
 
                // using column
                if (item["ID"].Text == "2")
                {
                    item.Display = false;
                }
}


Thanks,
Jayesh Goyani
0
RJ
Top achievements
Rank 1
answered on 27 Apr 2012, 09:42 PM
Thanks a lot Jayesh Goyani
0
gemr1423
Top achievements
Rank 2
answered on 10 Sep 2013, 09:56 PM
 Hi Jayesh Goyani,

I have a problem, I have a grid with some data, i tried to hide some rows because i dont need it, but the pagination show me the sum of a total registers including the hide registers, how can i do the correct pagination?

Thanks
0
Princy
Top achievements
Rank 1
answered on 11 Sep 2013, 09:06 AM
Hi ,

The RadGrid paging is performed on the items from the data source, so in order to achieve the desired functionality you need to remove the hidden items from the data source to which the RadGrid is bound.

I hope this helps.

Thanks,
Princy
Tags
Grid
Asked by
RJ
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
RJ
Top achievements
Rank 1
gemr1423
Top achievements
Rank 2
Princy
Top achievements
Rank 1
Share this question
or