您的位置:首页 > 其它

Rad:Grid Change Row BackGround Color (RadGrid)

2009-07-16 13:06 375 查看
Change the back color of the expanded row and the collapsed rows.

 

protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {

        //Expand a row , update the backcolor of the expanded row and other rows.
        if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item.Expanded == false)
        {
            

          foreach (GridDataItem item2 in RadGrid1.MasterTableView.Items)
            {
                if (item2 == (GridDataItem)e.Item)
                {
                    item2.BackColor = System.Drawing.Color.White;
                }
                else
                {
                    item2.BackColor = System.Drawing.Color.Gainsboro;
                }
            }
        }

        

        //Collaps a row , update the backcolor of all rows.

        if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item.Expanded == true)
        {
            foreach (GridDataItem item2 in RadGrid1.MasterTableView.Items)
            {
                item2.BackColor = System.Drawing.Color.White;               
            }
        }  

    }

 

http://www.telerik.com/community/forums/aspnet-ajax/grid/rad-grid-change-row-background-color.aspx

http://www.telerik.com/community/forums/aspnet/grid/set-background-color-of-a-row-in-client-script.aspx

http://www.telerik.com/community/forums/aspnet-ajax/grid/grid-row-background-colour-confliction.aspx

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: