Frage

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.

War es hilfreich?

Lösung

For row appearance changes handle ASPxGridView.HtmlRowPrepared event.
For cell appearance changes handle ASPxGridView.HtmlDataCellPrepared event.

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top