Last active
September 7, 2023 09:03
-
-
Save hendrasyp/c1d0ed033d7f5c076f71bd132f0812d6 to your computer and use it in GitHub Desktop.
DevExpress GridView HTML RowPrepared
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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