This is a migrated thread and some comments may be shown as answers.

Set border color in radgrid batchedit using batchmanager

3 Answers 16 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Neil
Top achievements
Rank 1
Neil asked on 23 Jan 2020, 02:23 PM

Hi,

   I have set up some code that fires when the "save changes" link it clicked during a batchedit session. The only goal I have here is to set the border color to red if the number entered does not fall into a certain range. I've left the test for the range out of the code below because it isn't important. 

  I have looked through countless telerik posts and finally came upon a line of code to set the bordercolor of the cell to red that doesn't blow up and tell me that some part of the line of code has a property or method that doesn't exist in the idcell object (see below); the line of code does execute with no error:

idCell.style.backgroundColor == "red";

However the cell border does not turn red;

I am confident that the code I'm using does access the cell because this line does work:

  var id = batchManager.getCellValue(idCell);

So basically I can't figure out how to turn the border color to red. Here is a boiled down version of the code to give you an idea of what code I'm using. Any help would be appreciated:

if (args.get_commandName() == "BatchEdit") {
                var masterTable = sender.get_masterTableView();
                var batchManager = sender.get_batchEditingManager();
                var dataItems = masterTable.get_dataItems();
                var idCell = dataItems[i].get_cell("LINE")
                var id = batchManager.getCellValue(idCell);
                var regexpString = "^\\d+\\.\\d{0,decimal}$";
                var fieldValid = regexp.test(id);
                if (fieldValid)
                    batchManager.changeCellValue(idCell, id);
                idCell.style.backgroundColor == "red"; //THIS DOES NOT TURN TO BORDER TO RED
}

 

3 Answers, 1 is accepted

Sort by
0
Neil
Top achievements
Rank 1
answered on 23 Jan 2020, 02:28 PM
Whoops. The code is trying to set the backgroundcolor which I tried as an experiment hoping to change ANY COLOR IN THE CELL to point me in the right direction. I really do want to change the border color here. Sorry for the error.
0
Neil
Top achievements
Rank 1
answered on 23 Jan 2020, 03:30 PM

I am very embarrassed. i was almost there. I didn't notice that i had a double equal sign (==) in my assignment of the background color. Honestly I thought it would error out but it didn't .For those who have run into the same issue the code is:

 

idCell.style.borderColor = "red";

 

Sorry :-) This is closed.

0
Vessy
Telerik team
answered on 27 Jan 2020, 09:23 AM

Hi,

Nothing to worry about, Neil - such omissions are normal for each developer :) I am happy to know that everything is working properly now.

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Neil
Top achievements
Rank 1
Answers by
Neil
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or