Wednesday 13 August 2014

USING CHECKBOX MARK / UNMARK WHOLE RECORDS

Scenario:-

                  I have a table(MarkAllTable) with one Boolean field(Mark) and add this table as a datasource into the  form(MarkAllTable).Now I want to add one checkbox control into the form. The condition is if I check this checkbox all records should be checked and if I uncheck this checkbox all records should be unchecked. Based on Checkbox we want to mark or unmark all records in the form.
 
we have to follow some steps....
Step 1:
             Create a table(MarkAllTable) and add fields. Add one field as Enum and set the property as Boolean.
 
 
 
Step 2:
              Insert some Records into the Table and add that Table as a Datasource into the form.Now drag and drop the fields into design level.
 
Step 3:
            Add a CheckBox control(MarkAll) into the design level.
 
 
Step 4:
            Now we want to write code for mark or unmark the records.
 
 
 
Write code under CheckBox Control in Clicked() method.
 
public void clicked()
 
{
MarkAlltable markAlltable1;
super();
 while select MarkAlltable
 
{
if( MarkAll.value()==1)
 
 
{
MarkAlltable.Mark=boolean::true;
 
 
}
else
 
{
MarkAlltable.Mark=boolean::false;
 
 
}
MarkAlltable.update();
}

 
MarkAlltable_ds.executeQuery();

 

}
 
Step 5:
        Now we have the output.
 
 
 
 
 
 
 
 
 
 
 
 

No comments:

Post a Comment