Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
865
Highlight new added row from code behind
posted

Hi Team,

I have a web data grid where I am adding rows to it via javascript

function AddRow() {
var grid = $find('<%= dgKeyWords.ClientID %>');
var editing = grid.get_behaviors().get_editingCore();
var rowAdding = editing.get_behaviors().get_rowAdding();
rowAdding._commitRow();
}

Now , I have OnRowAdding server side event that is doing some business validation and returning the error message if any.

My requirement is that if user adds 3-4 new rows and saves the data (batch update) and there comes error on row 1 and 3 (of newly added row), how can I make them highlighted once page renders back..

I am able to do so for existing rows if I am updating records as I am getting row index and based on that  I am highlighting rows as 

  dgKeyWords.Rows[failedBandIndex].CssClass = AppStylingManager.Settings.CssRegistry.Add("background-color:OrangeRed;", "tbody>tr.{0}>td", false); where failedBandIndex is the index of an existign row.

For newly added row, I can not access the same via  dgKeyWords.Rows[failedBandIndex].. So how to highlight the newly added rows if required?

Varun