Allow ASP.NET form to be used after downloading a file in SharePoint webpart

Solution: the most effective solution: add “_spFormOnSubmitCalled=false;_spSuppressFormOnSubmitWrapper=true;” to OnClientClick of the button

<asp:LinkButton ID=”lbExport”
runat=”server” Text=”Export”
OnClick=”lbExport_Click”
OnClientClick=”_spFormOnSubmitCalled=false;_spSuppressFormOnSubmitWrapper=true;”/>

Solution:

Add this code to the .ascx file

<script type=”text/javascript”>
    function setFormSubmitToFalse() {
        setTimeout(function () { _spFormOnSubmitCalled = false; }, 3000);
        return true;
    }
</script>

Then, for the download button, add the code to call this function after user clicks it

OnClientClick=”setFormSubmitToFalse”

Another way is to refresh the page on client after certain time

onclientclick="timedRefresh(2000)"

then in your html..

    <script type="text/JavaScript">
    <!--
    function timedRefresh(timeoutPeriod) {
        setTimeout("location.reload(true);",timeoutPeriod);
    }
    //   -->

EventReceiver cheat sheet

List item:
List BeforeProperties AfterProperties properties.ListItem
ItemAdding No value New value Null
ItemAdded No value New value New value
ItemUpdating No value Changed value Original value
ItemUpdated No value Changed value Changed value
ItemDeleting No value No value Original value
ItemDeleted No value No value Null
Document Library:
Library BeforeProperties AfterProperties properties.ListItem
ItemAdding No value No value Null
ItemAdded No value No value New value
ItemUpdating Original value Changed value Original value
ItemUpdated Original value Changed value Changed value
ItemDeleting No value No value Original value
ItemDeleted No value No value Null

Allow workflows to change approval status

Follow the instructions of the last answer at the end of the page.

https://social.technet.microsoft.com/Forums/office/en-US/9292c3ef-b456-4115-8b9c-bfa63782dfd5/workflow-can-use-app-permissions-feature-is-not-activating?forum=sharepointadmin

If Workflow Service Application is not displayed, enabled it by launching the Farm Configuration Wizard.

Don’t debug often

Sometimes it’s better to code the whole module first instead of debugging and testing continuously. Debugging is very time consuming especially for heavy applications like SharePoint’s.

If the deadline is approaching, at least you have a module that has already been thought out, you can mitigate problems later. It’s a better solution that trying to implement the module when deadline approaches.

For big application, debugging is very time consuming and disruptive to your flow.
Write code in big chunks, then debug once in one session to save time.

Ways to debug ASP.NET and Sharepoint webparts

Either run Debug from Visual Studio, which will retract and redeploy the project before deploying and more time consuming

Or, From “Debug”, select “Attach to process…” and attach the debugger to the w3wp.exe processes and start debugging. Make sure to open the browser and browse the site first to start the processes before attaching.

How to expand VMWare virtual hard drive storage

To expand the VM’s hard drive, make sure you have enough free space in your physical harddrive to commodate the old file + the new file.

e.g: to expand the virtual hard drive from 80GB to 100GB, you need 100GB free space in the hard drive story the VD, not 20GB, but 100GB.

This is because VMWare will create a new file with the size of 100GB and copy the content from the 80GB VD over, then delete the 80GB VD