Skip to content

Instantly share code, notes, and snippets.

@hendrasyp
Last active September 7, 2023 09:03
Show Gist options
  • Save hendrasyp/c1d0ed033d7f5c076f71bd132f0812d6 to your computer and use it in GitHub Desktop.
Save hendrasyp/c1d0ed033d7f5c076f71bd132f0812d6 to your computer and use it in GitHub Desktop.
DevExpress GridView HTML RowPrepared
// 1. Tambahkan event OnHtmlRowPrepared pada Grid
protected void gridDaftarPasien_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e)
{
if (e.RowType != GridViewRowType.Data)
return;
// Dapatkan nilai dari si kolom
string status = e.GetValue("NamaKolom").ToString().ToLower();
// apa yang dilakukan pada grid jika memenuhi suatu kondisi tertentu
switch(status)
{
case "a":
// Warna Font
e.Row.ForeColor = ColorTranslator.FromHtml(System.Drawing.Color.White;);
e.Row.BackColor = System.Drawing.Color.Red;
break;
case "b":
// Warna Font
e.Row.ForeColor = ColorTranslator.FromHtml(System.Drawing.Color.White;);
e.Row.BackColor = System.Drawing.Color.Red;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment