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

How to remove item in radgrid?

1 Answer 319 Views
Grid
This is a migrated thread and some comments may be shown as answers.
phongphan phromsamut
Top achievements
Rank 1
phongphan phromsamut asked on 27 Apr 2010, 04:56 AM
    
  if (((System.Boolean)groupDataRow[6]) ? Math.Round((System.Decimal)groupDataRow[4], 3) >= Convert.ToDecimal(groupDataRow[9]) : Math.Round((System.Decimal)groupDataRow[4] * 1000, 3) >= (Convert.ToDecimal(groupDataRow[9]) * 1000))  
    {    
           help need to Delete item from this code.

    }



    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) {  
            GridDataItem item;  
            //if (!this.Radgrid2BindFirstTime && Twice<2) {  
                if (e.Item is GridDataItem) {  
                    item = (GridDataItem)e.Item;  
                    DataRowView groupDataRow = (DataRowView)e.Item.DataItem;  
                    if (Convert.ToString(groupDataRow[9]) == "")  
                    {  
                        this.SumaFCPercent += (System.Decimal)groupDataRow[3];  
                        item["Cantidad"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round((System.Decimal)groupDataRow[4], 3)) + " Kg" : Convert.ToString(Math.Round((System.Decimal)groupDataRow[4] * 1000, 3)) + " gr";  
                        //Add min, max weight by PHP Nov 24 09  
                        item["Min weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[7])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[7])), 3)) + " gr";  
                        item["Max weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[8])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[8])), 3)) + " gr";  
                        item["Actual weight"].Text = ((System.Boolean)groupDataRow[6]) ? "Kg" : "gr";  
                        ////-----------------------------------  
                        if (!(System.Boolean)groupDataRow[6])  
                        {  
                            /*DARLE FORMATO A LAS CANTIDADES EN GRAMOS*/  
                            item["Cantidad"].BorderWidth = 3;  
                            item["Cantidad"].BorderStyle = BorderStyle.Solid;  
                            item["Cantidad"].BorderColor = System.Drawing.Color.DimGray;  
                            item["Cantidad"].BackColor = System.Drawing.Color.FromArgb(201, 205, 224);  
                        }  
 
                        //item["Cantidad"].Text = Convert.ToString(groupDataRow[5]) + (((System.Boolean)groupDataRow[7]) ? " Kg" : " gr");  
                        if ((System.Boolean)groupDataRow[6])  
                        {  
                            //Cantidad expresada en Kilos  
 
                        }  
                        //item.Cells[4].Text += " <strong>" + Math.Round(this.SumaFC, 2) + "</strong>";  
                        //item.DataCell.Text += ((System.Decimal)groupDataRow["CorrectCostUsageWoScrap"] / (int.Parse(groupDataRow["TotalUsageVal"].ToString()))).ToString();  
                    }  
                    else  
                    {  
                        if (((System.Boolean)groupDataRow[6]) ? Math.Round((System.Decimal)groupDataRow[4], 3) >= Convert.ToDecimal(groupDataRow[9]) : Math.Round((System.Decimal)groupDataRow[4] * 1000, 3) >= (Convert.ToDecimal(groupDataRow[9]) * 1000))  
                        {  
 
                            item["Min weight"].Text = "";  
                            item["Max weight"].Text = "";  
                            item["Actual weight"].Text = "";  
                            item["Cantidad"].Text = "";  
                            item["FCPercent"].Text = "";  
                            item["TrueName"].Text = "";  
                            item["code"].Text = "";  
                            item["column"].Text = "";  
                            item["column1"].Text = "";  
                            item["column2"].Text = "";  
                              
                        }  
                        else  
                        {  
                            this.SumaFCPercent += (System.Decimal)groupDataRow[3];  
                            item["Cantidad"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round((System.Decimal)groupDataRow[4], 3)) + " Kg" : Convert.ToString(Math.Round((System.Decimal)groupDataRow[4] * 1000, 3)) + " gr";  
                            //Add min, max weight by PHP Nov 24 09  
                            item["Min weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[7])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[7])), 3)) + " gr";  
                            item["Max weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[8])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[8])), 3)) + " gr";  
                            item["Actual weight"].Text = ((System.Boolean)groupDataRow[6]) ? "Kg" : "gr";  
                            ////-----------------------------------  
                            if (!(System.Boolean)groupDataRow[6])  
                            {  
                                /*DARLE FORMATO A LAS CANTIDADES EN GRAMOS*/  
                                item["Cantidad"].BorderWidth = 3;  
                                item["Cantidad"].BorderStyle = BorderStyle.Solid;  
                                item["Cantidad"].BorderColor = System.Drawing.Color.DimGray;  
                                item["Cantidad"].BackColor = System.Drawing.Color.FromArgb(201, 205, 224);  
                            }  
                        }  
                    }  
                }  
 
                if (e.Item is GridFooterItem)  
                {  
                    GridFooterItem item_ = (GridFooterItem)e.Item;  
                    item_["FCPercent"].Text += Math.Round(this.SumaFCPercent, 3) + "%";  
                    item_["Cantidad"].Text += Math.Round((this.SumaFCPercent / 100) * Convert.ToDecimal(this.systemcap), 3) + "Kg";  
                    //DataRowView groupDataRow = (DataRowView)e.Item.DataItem;  
                    //item.Cells[4].Text += this.SumaFC.ToString();  
                }  
 
                //foreach (Item)  
                //{  
                //    e.Item.OwnerTableView.PerformDelete(item, true);  
                //}  
 
        } 

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 28 Apr 2010, 05:18 PM
Hi phongphan,

You need to delete the item from the underlying datasource to which you have data-bound the grid and call the grid's Rebind() method.

Hope it helps.

Regards,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
phongphan phromsamut
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or