How to change backcolor of GridControl (DevEkspress) - grid

Hi How can i change backcolor of gridcontrol(gridview devekspres)
example;
dim r=10
datagridview1.rows(r).DefaultCellStyle.backcolor=color.red
(datagridview codes not working with gridcontrol(gridview devekspres)
What I have tried:
i used
GridView2.Appearance.FocusedRow.BackColor = Color.Red
but its colored only focused row

Related

Format jQgrid editable textbox height

I am using jQgrid version 4.6.0 (Free version) and trying to edit the height of textbox which gets rendered when we set editable: true in Column model. I want the textbox height to fit into complete grid cell.
Here the width of rendered textbox is fine and fits in the cell but how can I increase the height of textbox?
Trying to achieve:-
There are some trick which you can use. You can editoptions in the column defined something like
editoptions: { style: "height:40px;" }
It will set style attribute on the textbox creating during editing. I think that the trick will work for any editing mode which you will use.
UPDATED: One can do the following in case of usage cell editing:
afterEditCell: function (rowid, cellname, value, iRow, iCol) {
var tr = this.rows[iRow], h = $(tr).height(),
$input = $(tr.cells[iCol]).find("input"),
delta = $input.outerHeight() - $input.height();
$input.height(h - delta);
}
Inside of the most callbacks this will be initialized to the DOM of the <table> element (see here), which supports rows property to quick access to the row by rowIndex and the row (<tr>) supports cells array which can be used to get the cell by cell index. The rest of the code should be clear I hope.

Change fore color hyperlink using datatable

i have hyperlink that the color of text will diffrent based on it value, if the value is 0, the color is black, if the value >0 it will red, here the code i have tried
ForeColor='<%#IIf(Eval("exception") = 0, "Black", "Red")%>'
but it give me error"
"The server tag is not well formed."
can anybody help me?
You can change its property in code behind.You just have to assign different CssClass based on values in value change event.
HyperLink1.CssClass = "NewClass"
Try Like below,
ForeColor='<%#(DataBinder.Eval("exception").ToString()=="0") ? "Black" : "Red"%>'

How to set an image for a row?

I want to add text (at the beginning of a row) and an image at the end of the row.
I can set the text but how to set an image at the end of the row item in QTreeWidgetItem?
Just set for example two columns in QTreeWidget and then set text in first one and icon in second one:
QTreeWidgetItem *newItem = new QTreeWidgetItem;
newItem->setText(0, "Something");
newItem->setIcon(1, QIcon("Path to your icon"));
myTreeWidget->addTopLeveItem(newItem);
Or instread of setting icon you can just set foreground:
newItem->setForeground(QBrush(QPixmap("Path to your image")));
which may be better for your problem.

Format datagrid column color

I have a advanced datagrid label function like this:
private function dgFormat(item:Object, column:AdvancedDataGridColumn):String{
var v3:int = item.value1 - item.value2;
return "Total: " + v3;
}
How can I change the text color of v3 dynamically? I want it to be red if it's less than zero & black otherwise.
thanks!
There's a few ways of doing this, but personally if I were you, I'd just create a custom item renderer for the columns that you want the color to change and do something like:
<s:Label text="Total: {data}" color="{data < 0?0xFF0000:0x000000}" />
This way, you bind the difference right off the bat without having to add 'total' in your data, and bind the color change as well.
You'll need a custom item renderer for your AdvancedDataGridColumn. The item renderer will check the value being set, and update the color of the text depending on its content.
This should get you started.

How to color item text in GridView for non-selected lines only?

I have a GridView with image buttons for selecting rows. I am using an OnRowDataBound event to color selected rows Blue:
e.Row.ForeColor = System.Drawing.Color.Blue
Now that works great as long as I don't set a color either in the CSS stylesheet or on the grid Items themselves. If I do that, then all rows are colored that color and I don't get my Blue selected rows color for selected rows. I would like to color the text in the grid something other than black. Any ideas how to get around this?
One way is just to have ASP.NET write the style to each cell in the row so that it overrides any CSS at the row level. Try...
foreach(TableCell cell in e.Row.Cells)
{
cell.ForeColor = System.Drawing.Color.Blue;
}

Resources