Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ENTITY/LINQ/ASP.NET : ASPxGridView Adding Rules

I am working on a small project which uses Entity Framework and I am currently learning about ASPxGridView, however, I cannot seem to find anything on the internet which relates to adding rules to columns which then shows either an icon or highlights the row depending on the rules set.

Something like this: https://demos.devexpress.com/ASPxGridViewDemos/Rows/ConditionalFormatting.aspx

If anyone could send me any references that they can find that may help point me in the right direction, it would be appreciated.

Thanks.

like image 356
Jaquarh Avatar asked Sep 25 '22 09:09

Jaquarh


1 Answers

Front end to add on the Entity Framework ASPxGridView Model:

OnHtmlDataCellPrepared="ASPxGridView1_HtmlDataCellPrepared"

Back end to add:

// Add this in the Namespace area, not inside the Page_Load function
public bool ProcessSelectionChangedOnServer { get; set; }

protected void ASPxGridView1_HtmlDataCellPrepared(object sender,
DevExpress.Web.ASPxGridViewTableDataCellEventArgs e)
{
    // if statements go here
    e.Cell.BackColor = System.Drawing.Color.LightCyan;
}

Code result:

All Cell background colors change to LightCyan

References:

ASPxGridView.HtmlRowPrepared Event
TreeListSettingsBehavior.ProcessSelectionChangedOnServer Property

like image 82
Jaquarh Avatar answered Sep 29 '22 06:09

Jaquarh