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

Parents
No Data
Reply
  • 25665
    Offline posted

    Hello Varun,

    Thank you for contacting Infragistics!

    I have done some looking into this matter and have the following information. As in the RowAdding event the row is still in the process of being added to the grid you can’t add the CSS to the row yet. What you can do is make a list/array rows that fail validation the in the button click add the CSS to the row with the following code:

    WebDataGrid.Rows[RowIndex].CssClass = “cssClassName”;

    Please let me know if you have any further questions concerning this matter.

Children