1

I have custom webpart which gets data from external database using BCS. When I add the webpart in a webpart zone, it queries the BDC to get data so it take time to insert webpart. I only want to query data in display mode.

  • 1
    please use some punctuation and clarify your question. Actually, there is no question in your words. Read the How to Ask page for more help. – Steve B Jul 13 '12 at 12:07
1

Assuming you have created this WebPart yourself, you should check the SPControlMode. Example:

        if (SPContext.Current.FormContext.FormMode != SPControlMode.Edit)
        {
            //Query BDC
        }
  • This is not working as i am getting FormMode Invalid. – Ronak Jul 16 '12 at 14:01
  • Could you please clarify? Is FormMode populated with a 0 / SPControlMode.Invalid? – J Torres Jul 16 '12 at 14:44
  • Hi Torres it populated with Invalid in design mode meaning when i try to add webpart. – Ronak Jul 16 '12 at 20:38
  • I'm at a loss here as I use this on a regular basis for disabling RequiredFieldValidators. Is there something unusual about your particular setup? – J Torres Jul 17 '12 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.