Set Label text in the grid on button click
i am using AW grid with Label and textbox in each and every row, By default i have created the label in all rows with empty on the time of grid creation.Here i want to show the error msg in the corresponding label in the row while user picking the button in case of particular row textbox is empty. I have been using the below coding but the msg is set only in last row label.Anyone help me to get out this problem.
Mycode
-------
//The below code executed on the grid creation
var lbl = new AW.UI.Label;
for(var icount=0;icount<myCells.length;icount++)
{
lbl = new AW.UI.Label;
lbl.setId("label"+icount);
lbl.setControlText("");
lbl.setStyle("font-family", "Verdana");
grid.setCellTemplate(lbl,<%= cMessage %>,icount);
lbl.getContent('box/text').setAttribute('readonly', true);
}
//This function called on button click
function SaveData()
{
for (var col=0; col<myCells.length; col++)
{
if(grid.getCellTemplate(1, col).getControlText()=="")
{
lbl.setControlText("should not be empty");
grid.setCellTemplate(lbl,2,col);
}
else
{
lbl.setControlText("");
grid.setCellTemplate(lbl,2,col);
}
}
}
Mycode
-------
//The below code executed on the grid creation
var lbl = new AW.UI.Label;
for(var icount=0;icount<myCells.length;icount++)
{
lbl = new AW.UI.Label;
lbl.setId("label"+icount);
lbl.setControlText("");
lbl.setStyle("font-family", "Verdana");
grid.setCellTemplate(lbl,<%= cMessage %>,icount);
lbl.getContent('box/text').setAttribute('readonly', true);
}
//This function called on button click
function SaveData()
{
for (var col=0; col<myCells.length; col++)
{
if(grid.getCellTemplate(1, col).getControlText()=="")
{
lbl.setControlText("should not be empty");
grid.setCellTemplate(lbl,2,col);
}
else
{
lbl.setControlText("");
grid.setCellTemplate(lbl,2,col);
}
}
}
sabi
September 4,