Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
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
    
Your accept rate isn't good either ronak –  Muhammad Raja Jul 13 '12 at 15:37

1 Answer 1

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

        if (SPContext.Current.FormContext.FormMode != SPControlMode.Edit)
        {
            //Query BDC
        }
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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