To All,
I am using a WebDataGrid for data entry via a barcode scanner. Don't get frightened, it just keyfakes in an item's serial number. The folks here helped me out with that one. Basically, they have me trap the Grid_KeyDown client side event so I can trap for the Enter key and drop to the next row - thus firing the server side RowUpdating event. Then, I can process server side database management via the server side Grid_RowUpdating event. All is good. My inventory records are being updated just fine.
The problem is when there is an error. Maybe the item is still marked as issued to someone else - that is, the item was not updated in the database by the operators when the item was returned. Oh, well.
What I am looking for is a way to 'style' the background color of the row if the database update process on the server side RowUpdating event cannot issue the item. I am able to save something like "ERROR" in an hidden unbound column in the row. When I set the CssClass property of the selected row and or colum in RowUpdating that setting does not get applied (even with !important). When I force a postback via a button the row/column that should have "ERROR" in it is empty (although displayed). When I attempt to apply CSS to some visible row in the button postback I see no changes to the background color.
I think I have an event flow issue, but am not certain...
Hello,
Thank you for contacting us!
Changing the style shouldn't be a problem related to the event flow, by my opinion the issue is in your CSS selector and class that you use. I have created a sample for you in order to show how to change the style of a row after updating.
Code snippet:
Markup:
<style> tbody.igg_IGItem > tr.NewItemClass > td { background-color:Red; text-align: center; } style>
Code behind:
protected void WebDataGrid1_RowUpdating(object sender, RowUpdatingEventArgs e) { e.Row.CssClass = "NewItemClass"; }
Helpful references:
http://www.infragistics.com/community/forums/t/87001.aspx
http://www.infragistics.com/community/blogs/engineering/archive/2010/08/25/webdatagrid-css-styling-guide.aspx
Thank you Zdravko. That was the problem.
I have been reviewing the linked forum entry, but it was a bit more complicated than what I was looking for. Got close with it. Your concise answer here solved my issue - and, yes I was apparently going through a programming rabbit hole with the event flow.
I am glad that I've managed to help you!
Thank you for using our controls.