Reputation: 35
I have a web project with devexpress component ASPxGridView. So I want to know is any apportunity to change rows appearences, and also to make conditional appearance providing some rules. I know how it works in windows application and want the same in aspx net.
Upvotes: 0
Views: 3381
Reputation: 2379
Citing the example you gave you must make use of GridView Events. Like DataBount event is fired upon binding your data so you can change appearance like this:
protected void GridView1_DataBound(object sender, EventArgs e)
{
int rowindex = e.Row.RowIndex;
if (/* Your Condition */)
{
GridView1.Rows[rowindex].BackColor = System.Drawing.Color.Red;
}
}
in your aspx however you have to do something like this:
OnRowDataBound="GridView1_DataBound"
Similarly you can change appearance in other events like OnRowCreated which is fired at the time of Row Creation as name suggests.
Upvotes: 1
Reputation: 3347
For row appearance changes handle ASPxGridView.HtmlRowPrepared event.
For cell appearance changes handle ASPxGridView.HtmlDataCellPrepared event.
Upvotes: 1