Set radgrid row background color dependant on bound column - radgrid

I would like to configure my RadGrid to show a icon or perhaps a different row colour when a activity flag in the bound row is set to true.
Can I do this in JS?
Basically I have a grid of data bound to a entity statement in code behind. One of the columns is TicketActivity and when set to true I would like the gridrow to show an icon (red dot or something) or change the background colour of the grid row.

Related

Objective C-OSX How to change color of NSTableViewCell when selecting?

there are 3 cell in my table view
my table is view base table
my requirement is when i select any cell(click on any row) text color and background color of that(selected cell) table view cell change
A naive solution could be using NSTableViewDelegate declared as tableViewSelectionDidChange:. Inside it use the property selectedRowIndexes, which will provide the currently selected rows. Then customize those cell as you want (changing the background color or whatever else).
NB :: don't forget to clear the cell's which are not in the selectedRowIndexes, otherwise deselcting won't change their state

Can't get DataGridView cell BackColor property

I'm trying to retrieve the current color of a DataGridView cell while iterating through the Grid. I am explicitly setting the BackColor for both RowsDefaultCellStyle and AlternatingRowsDefaultCellStyle in the Form Load event.
I'm trying to get the cell BackColor per this question, however, at run time, while iterating through cells in a row, in the Immediate Window this: ?dgvemployees.Rows(rowIndex).Cells(i + 1).Style.BackColor.ToString returns "Color [Empty]" every time - even if I change the indexes to get another cell that I know has the default color set.
Am I missing something or not doing something right?
This page on the Cell Style says:
The DataGridView control displays its cells using the styles indicated
by the cell InheritedStyle property, which inherits styles from other
properties of type DataGridViewCellStyle. The styles specified through
the Style property override the styles specified through all other
cell-style properties, but do not necessarily indicate all the styles
that contribute to the cell's appearance.
Basically, you are trying to access the specific cell back color when it hasn't been set. Even though you have set the back color of the rows, it can be overridden at the cell level.
Thankfully, Microsoft has given us a nice way to find the inherited style of the cell, which will get you the grid-level setting for these cells (unless something further down the chain has overridden that).
?dgvemployees.Rows(1).Cells(2).InheritedStyle.BackColor.ToString()
If I had something else that could override this value and cause problems, then I think I'd be left doing a modulus on the row count to see if it was an alternating row or not.

Data Grid View VB.net 2013 , How many rows and which are visible in window?

I have a datagridview control with 10 rows on my form window.
Now lets suppose the size of the datagridview in the form can only display 5 rows to user and user has to use vertical scroll bar to see the other 5 rows.
now my question is :
Is there any way to know which 5 rows are currently visible to the user according to the position of scroll bar.
Actually in my program currently i am updating the all the rows value one by one of that datagridview table continuously.
Now i want to only update the rows that are visible in the window. so how can i know what rows are visible according to scroll bar position.
Thanks in advance
The DataGridView control exposes a VerticalScrollingOffset property which can be used to determine how far the view is scrolled. If you know the height of each row in the DataGridView in pixels, you can then calculate which rows of the table are currently visible and refresh them.
The height of each row can be determined through the DataGridViewRow property Height. This defaults to the font height, plus 9 pixels - if you're using the same font size in all rows this should be consistent.
EDIT: Further digging through the documentation shows that each DataGridViewRow exposes a Displayed property that returns true when the row is visible on the user's screen. Checking that would be much easier!
MSDN on DataGridViewRow.Displayed property

WinForms TableLayoutPanel ComboBox not resizing properly

I'm trying to use a TableLayoutPanel to align a few controls on a form next to their labels like so:
Label1 [combobox ]
LongerLabel [longer combobox]
But when I run the project and grab the right hand side of the form and shrink the form, the combobox doesn't resize, it gets cut off... Now, I were to not use the TableLayoutPanel, but just anchor a combobox to a form's edges, it will resize properly. What am I doing wrong with the TableLayoutPanel?
I found the answer here:
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.windowsforms.controls/2006-12/msg00209.html
So I set the first column with the label to autosize (I have the label fill docked in the cell and the text alignment set to middle left). Then dock fill the combobox in the second column. Then, set the second column's size type to 100%, NOT autosize. I don't know why it works, but it does.

changing the position of textbox using code

In my form I have an AXVS Flex Grid and a Textbox. Firstly the textbox will not be visible.
When the focus is on a particular column of the flexgrid, the textbox will be visible and the Flex Grid will be disabled. The position of the text box will be at the bottom of the particular row at the first time.
But when another row is inserted, then I need to change the position of the textbox to the bottom of the new row and so on.
How can I do that? Thanks in advance.
Position of a control can be retrieved and set using the Top & Left properties of the control.
So you can get the Top,Left property of the inserted row and set the Top,Left property of TextBox accrodingly.
e.g.
TextBox1.Top = InsertedRow.Top +=10
TextBox1.Left = InsertedRow.Left
This will bring the textbox below inserted row.