Monday, July 8, 2013

How to send requrest after executing Response.End() statement

Once I have to create a custom search on list item for some of the item fields and then it can be exported to excel. I successfully developed a custom visual web part which display only those record which fulfilling the search criteria and is transferred to excel. But then i face one problem that first time when i search the record and export it to excel it works fine. But for the second time my request is not sent to server because of using Response.End() function to avail the user to download the exported record in excel file.


So following is the solution for the same. Add below JavaScript in  your web part design page.


<script type="text/javascript">
document.ready({
        _spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper = true;
});
</script>

and append following code in your page load event.


System.Web.UI.ScriptManager scriptManager = System.Web.UI.ScriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(this.btnToExport);

Please replace this.btnToExport with your button or your control on which you handle click event to export it to excel.


 

Monday, July 1, 2013

How to decrease Content DB Size

If your content DB size is more than its actual size then you have to remove items from your Recycle Bin.

Once you remove your item from Site Action -> Recycle Bin it will transffered to Admin Recycle bin. You have to remove it from there also.

http://yoursite/_layouts/AdminRecycleBin.aspx?View=2

Once you removed your data from here now see the size of your content db. Its reduced now.

Thanks.