Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Change checkbox status

Hi All,

I'm using a check box to show to user a status(true/false).

here I get a value from User table(isOverWrite) and if it is one I want to make check box checked = true.

But according to following code it doesn't check even that code line is executed successfully.Is there any mistake,please tell me

Thankyou

Buddhika

if (isOverWrite != -1)
    {
         SAPbouiCOM.CheckBox chbOverWrite = null;
           chbOverWrite = (SAPbouiCOM.CheckBox)frm.Items.Item("chbOVwrite").Specific;
          if (isOverWrite == 1)
              {                                             chbOverWrite.Checked=true                                                                                
}
               else
               {
                     chbOverWrite.Checked = false;
                 }
                chbOverWrite.DataBind.SetBound      (true, "", "over_write"); 
                            }
frm.Update();

replied

Hi Buddhika,

You should bind your checkbox before you assign it.

Your code become :

if (isOverWrite != -1)

{

SAPbouiCOM.CheckBox chbOverWrite = null;

chbOverWrite = (SAPbouiCOM.CheckBox)frm.Items.Item("chbOVwrite").Specific;

chbOverWrite.DataBind.SetBound (true, "", "over_write");

if (isOverWrite == 1)

{ chbOverWrite.Checked=true

}

else

{

chbOverWrite.Checked = false;

}

}

frm.Update();

Try this and tell me if it's working or not.

Regards

Michael

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question