August 7, 2012

Getting current record of data control from program

By using the below code, we can get the current row from the data control.

BindingContext bindingctx = BindingContext.getCurrent();
BindingContainer bindings = bindingctx.getCurrentBindingsEntry(); 
DCBindingContainer bindingsImpl = (DCBindingContainer)bindings; 
DCIteratorBinding iter =  bindingsImpl.findIteratorBinding(<binding iterator>); 
Row currentRow=iter.getCurrentRow();

Where <binding iterator> is the iterator name which data control is binded to the page and holds the data