tag:blogger.com,1999:blog-58158333038168554912024-03-15T21:10:07.774-04:00Official Lanteria BlogSergey Turinhttp://www.blogger.com/profile/03710663408427420967noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-5815833303816855491.post-58109136366351314002012-05-24T11:01:00.001-04:002012-05-24T11:06:43.812-04:00Again about SharePoint list performance…<div dir="ltr" style="text-align: left;" trbidi="on">
We have been refactoring some elements of our <a href="http://www.lanteria.com/Products/EffectiveStaff-Full-sharepoint-hr.aspx" target="_blank">SharePoint HR solution</a> in terms of improving the performance of reading data from SharePoint lists (thousands of items). <br />
<br />
I’d like to share few “bottlenecks” we faced and their solutions. <br />
<br />
<strong>1. ViewFields property of SPQuery </strong><br />
There are a lot of recommendations to use SPQuery.ViewFields property to limit the set of fields returned by your query. <br />
<br />
However, sometimes it is ignored when you need to read all the fields you have created. <br />
<br />
We recommend defining this property anyway as far as SPQuery would read a number of internal fields, which you probably do not need. <br />
<br />
So in our case defining all our custom fields in combination with ViewFieldsOnly = True gave the significant performance improvement. <br />
<br />
<strong>2. SPUser field </strong><br />
User field is quite useful and popular when designing custom lists. However creating an SPUser object based on a field value takes very long time. <br />
<br />
The good news that in a lot of cases (like our) you do not really need a full SPUser object, but UserID or User Name only. <br />
<br />
User field contains a value similar to a Lookup (like, “1;#John Smith”). <br />
<br />
So instead of creating SPUser object, we just parsed that string and took ID and Name we needed. <br />
<br />
Again significant performance improvements… <br />
<br />
<strong>3. Lookups with additional fields.</strong> <br />
<br />
The great new feature of SharePoint 2010 is the ability to “map” additional fields when creating a Lookup field. However that brings additional overheads when you read such data. <br />
<br />
We had a list with 4 lookups and 2 of them had additional “mapped” fields. <br />
<br />
Reading only 2000 items have been taking a lot of time <br />
<br />
That’s a mystery how SharePoint treats that internally, however deleting of only one lookup with an additional field decreased the reading time about 5 times. <br />
<br />
Recommendation that is difficult to follow J but try to minimize lookup fields and especially mapping additional fields. <br />
<br />
<br />
<br />
There are not any world-shaking discoveries, however still the practical recommendations, which would probably help you. </div>Sergey Turinhttp://www.blogger.com/profile/03710663408427420967noreply@blogger.com17tag:blogger.com,1999:blog-5815833303816855491.post-31753347971396998312012-04-13T12:16:00.000-04:002012-04-13T07:50:52.578-04:00Export to excel/word saves blank document or problems with the ReportViewer 2010 in the SharePoint 2010. Again.<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="font-family: "Trebuchet MS",sans-serif; font-size: large;">Initial data</span></b><br />
<span style="font-family: "Trebuchet MS",sans-serif;">The disposition is the same like in the previous post: SharePoint 2010 -> Visual Web Part -> UpdatePanel -> Microsoft Report Viewer 2010.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><br />
<b><span style="font-family: "Trebuchet MS",sans-serif; font-size: large;">Situation</span></b><br />
<span style="font-family: "Trebuchet MS",sans-serif;">MRV 2010 generates correct report in the own report section. BUT when we click "Export to Excel/Word" and try to open generated document - we have a following warning: "The file you are trying to open '<FileName.xls>', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?". If we click yes - we have blank excel/word document.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"> </span><br />
<span style="font-family: "Trebuchet MS",sans-serif; font-size: large;"><b>Investigation</b></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">If we login as web-server's admin user and click "Export to Excel/Word" - we have correct documents without any warnings. If we login as" not admin" user - we have problem. So the reason is somewhere in the permissions. By "Procees Monitor" I found that "Network Service" had write error in one directory when it was trying to create excel document. It was a signal. </span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><br />
<b><span style="font-family: "Trebuchet MS",sans-serif; font-size: large;">Solution</span></b><br />
<span style="font-family: "Trebuchet MS",sans-serif;">This directory was "<b>C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp</b>". So to solve this problem - I just added "<b>Authenticated Users</b>" to this directory with "<b>Full Control</b> " permissions.</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">BUT! This path is not fully correct answer. This path just a special case... The correct answer is following - to add "<b>Authenticated Users</b>" with "<b>Full Control</b> " permissions to the temporary directory of your Web Application pool account. I had my pool that worked as "Network Service". So I used path as above. But ,for example, if your pool has identity = "Administrator.Office", your path could be following: <b>C:\Users\Administrator.OFFICE\AppData\Local\Temp</b>. And don't forget to do it on the server, not on your local PC.</span><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">It solved this problem for me. Hope it will help you.</span></div>Ivan Deynegahttp://www.blogger.com/profile/08029728050965950133noreply@blogger.com15tag:blogger.com,1999:blog-5815833303816855491.post-3905819741229484432012-03-23T11:00:00.000-04:002012-04-02T08:09:36.680-04:00UpdatePanel Progress Emulation or How to show "Progress" information when we need to generate full postback (by PostBackTrigger) in the UpdatePanel<span style="font-size: 12pt;"><b>Initial data</b></span><br />
<span style="font-size: 12pt; font-weight: normal; line-height: 115%;">We have an UpdatePanel. In this UpdatePanel we have two buttons. By clicking each button application does something. Also we have an UpdateProgress for the UpdatePanel. BUT one button generate full PostBack. </span>
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: none repeat scroll 0% 0% yellow; font-family: "Courier New"; font-size: 10pt;"><%</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt;">@</span><span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: #a31515;">Page</span> <span style="color: red;">Title</span><span style="color: blue;">="Home Page"</span>
<span style="color: red;">Language</span><span style="color: blue;">="vb"</span>
<span style="color: red;">MasterPageFile</span><span style="color: blue;">="~/Site.Master"</span>
<span style="color: red;">AutoEventWireup</span><span style="color: blue;">="false"</span>
<span style="color: red;">CodeBehind</span><span style="color: blue;">="Default.aspx.vb"</span>
<span style="color: red;">Inherits</span><span style="color: blue;">="UpdatePanelProgressEmulation._Default"</span>
<span style="background: none repeat scroll 0% 0% yellow;">%></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: none repeat scroll 0% 0% yellow; font-family: "Courier New"; font-size: 10pt;"><%</span><span style="color: green; font-family: "Courier New"; font-size: 10pt;">-- It is registration for a web user control that
include presentation layout of our progress information. --</span><span style="background: none repeat scroll 0% 0% yellow; font-family: "Courier New"; font-size: 10pt;">%></span></div>
<div class="MsoNormal">
<span style="background: none repeat scroll 0% 0% yellow; font-family: "Courier New"; font-size: 10pt; line-height: 115%;"><%</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">@</span><span style="font-family: "Courier New"; font-size: 10pt; line-height: 115%;"> <span style="color: #a31515;">Register</span>
<span style="color: red;">src</span><span style="color: blue;">="Preloader.ascx"</span> <span style="color: red;">tagname</span><span style="color: blue;">="Preloader"</span> <span style="color: red;">tagprefix</span><span style="color: blue;">="uc1"</span> <span style="background: none repeat scroll 0% 0% yellow;">%></span></span><span style="font-size: 13.5pt; line-height: 115%;"></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Courier New"; font-size: 10pt;"><</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt;">asp</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt;">:</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt;">Content</span><span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: red;">ID</span><span style="color: blue;">="BodyContent"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">ContentPlaceHolderID</span><span style="color: blue;">="MainContent"></span></span></div>
<div class="MsoNormal">
<span style="font-family: "Courier New"; font-size: 10pt; line-height: 115%;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">ScriptManager</span> <span style="color: red;">ID</span><span style="color: blue;">="ScriptManagerMain"</span>
<span style="color: red;">unat</span><span style="color: blue;">="server"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">ScriptManager</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Courier New"; font-size: 10pt;"><</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt;">asp</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt;">:</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt;">UpdatePanel</span><span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: red;">ID</span><span style="color: blue;">="UpdatePanelMain"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">Triggers</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="background: none repeat scroll 0% 0% yellow;"><%</span><span style="color: green;">--Register our full
postback action for button--</span><span style="background: none repeat scroll 0% 0% yellow;">%></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">PostBackTrigger</span> <span style="color: red;">ControlID</span><span style="color: blue;">="btnWithPostBackTrigger"</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">Triggers</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">ContentTemplate</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="background: none repeat scroll 0% 0% yellow;"><%</span><span style="color: green;">--UpdateProgress -
uses ucPreloader. As in the above code.--</span><span style="background: none repeat scroll 0% 0% yellow;">%></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">UpdateProgress</span> <span style="color: red;">ID</span><span style="color: blue;">="UpdateProgressMain"</span> <span style="color: red;">EnableViewState</span><span style="color: blue;">="false"</span> <span style="color: red;">AssociatedUpdatePanelID</span><span style="color: blue;">="UpdatePanelMain"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">ProgressTemplate</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">uc1</span><span style="color: blue;">:</span><span style="color: #a31515;">Preloader</span>
<span style="color: red;">ID</span><span style="color: blue;">="ucPreloader"</span>
<span style="color: red;">ClientIDMode</span><span style="color: blue;">="Static"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">ProgressTemplate</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">UpdateProgress</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Button</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">ID</span><span style="color: blue;">="btnWithoutPostBackTrigger"</span> <span style="color: red;">Text</span><span style="color: blue;">="Button without
PostBackTrigger "</span> <span style="color: red;">BackColor</span><span style="color: blue;">="#006600"</span> <span style="color: red;">BorderStyle</span><span style="color: blue;">="Solid"</span> <span style="color: red;">BorderColor</span><span style="color: blue;">="#003300"</span> <span style="color: red;">ForeColor</span><span style="color: blue;">="White"/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Button</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">ID</span><span style="color: blue;">="btnWithPostBackTrigger"</span> <span style="color: red;">Text</span><span style="color: blue;">="Button with
PostBackTrigger"</span> <span style="color: red;">BackColor</span><span style="color: blue;">="#CC0000"</span> <span style="color: red;">BorderStyle</span><span style="color: blue;">="Solid"</span>
<span style="color: red;">BorderColor</span><span style="color: blue;">="Maroon"</span>
<span style="color: red;">ForeColor</span><span style="color: blue;">="White"</span>
<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">ContentTemplate</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">UpdatePanel</span><span style="color: blue;">></span></span></div>
<span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;"></</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">asp</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">:</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">Content</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">></span><br />
<br />
<div class="MsoNormal">
<span style="font-size: 12pt; line-height: 115%;">The code of
the Preloader.ascx used to show progress info:</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="background: none repeat scroll 0% 0% yellow; font-family: "Courier New"; font-size: 10pt;"><%</span><span style="color: green; font-family: "Courier New"; font-size: 10pt;">--A simple Div that shows us "Loading"
message.--</span><span style="background: none repeat scroll 0% 0% yellow; font-family: "Courier New"; font-size: 10pt;">%></span><span style="font-family: "Courier New"; font-size: 10pt;"> </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Courier New"; font-size: 10pt;"><</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt;">div</span><span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: red;">style</span><span style="color: blue;">="</span><span style="color: red;">top</span>:<span style="color: blue;">150px</span>; <span style="color: red;">width</span>:<span style="color: blue;">100%</span>; <span style="color: red;">left</span>:<span style="color: blue;">0px</span>; <span style="color: red;">display</span>:<span style="color: blue;">block</span>;<span style="color: red;">position</span>:<span style="color: blue;">fixed</span>; <span style="color: red;">z-index</span>:<span style="color: blue;">2000</span>;<span style="color: blue;">"</span> <span style="color: red;">align</span><span style="color: blue;">="center"</span> <span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">table</span> <span style="color: red;">style</span><span style="color: blue;">="</span> <span style="color: red;">width</span>:<span style="color: blue;">600px</span>; <span style="color: red;">height</span>:<span style="color: blue;">200px</span>; <span style="color: red;">z-index</span>:<span style="color: blue;">2002</span>; <span style="color: red;">background-color</span>:<span style="color: blue;">#f9f9f9</span>; <span style="color: red;">border-style</span>:<span style="color: blue;">solid</span>; <span style="color: red;">border-color</span>:<span style="color: blue;">Grey</span>; <span style="color: blue;">"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">td</span> <span style="color: red;">valign</span><span style="color: blue;">="middle"</span> <span style="color: red;">align</span><span style="color: blue;">="center"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">h1</span> <span style="color: red;">style</span><span style="color: blue;">="</span> <span style="color: red;">color</span>:<span style="color: blue;">Navy"></span>Loading: 5000 milliseconds...<span style="color: blue;"></</span><span style="color: #a31515;">h1</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span> </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">table</span><span style="color: blue;">></span></span></div>
<span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;"></</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">div</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">></span><span style="font-family: "Calibri","sans-serif"; font-size: 13.5pt; line-height: 115%;"><br style="mso-special-character: line-break;" />
</span>
<br />
<span style="font-size: 12pt;">So, if we click this button with a full PostBack action - we don't see any Progress. If we click the button without the full PostBack action - we see this progress information. But it is not friendly for user, because in one time he sees progress info, in another time he doesn't see it. It would be much better if user has ability to see progress information for each situation.</span>
<br />
<br />
<span style="font-size: medium;"><b>Investigation</b></span><br />
<div style="font-family: "Trebuchet MS",sans-serif;">
<span style="font-size: 12pt;">There are many ways to solve this situation. But I select simplest way, as for me. And it is emulation of the showing of the progress info for Update Panel.</span></div>
<div style="font-family: "Trebuchet MS",sans-serif;">
<br /></div>
<div style="font-family: "Trebuchet MS",sans-serif;">
</div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-size: 13.5pt; line-height: 115%;">Solution </span></b></div>
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span style="font-size: 12pt; line-height: 115%;">The idea – to run JavaScript code by clicking our FullPostBack button. In any cases this code will be runned and will be executed before a moment when request of our page will be send to server and </span><span class="" id="result_box" lang="en"><span class="hps">will be back</span></span><span style="font-size: 12pt; line-height: 115%;">. We click button – and by JavaScript shows ProgressInfo. And until request don’t return from the server – we see our ProgressInfo. Also we don’t need to think how to hide our ProgressInfo, because when our request returns from server – we will have reRander of our page and it will hide our ProgressInfo automatically.</span></div>
<div style="font-family: "Trebuchet MS",sans-serif;">
<br /></div>
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span style="font-size: 12pt;"><span style="line-height: 115%;">Code in aspx
file…</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Courier New"; font-size: 10pt;"><</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt;">div</span><span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: red;">id</span><span style="color: blue;">="divPreloader"</span>
<span style="color: red;">style</span><span style="color: blue;">="</span><span style="color: red;">visibility</span>:<span style="color: blue;">hidden</span>;<span style="color: blue;">"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">uc1</span><span style="color: blue;">:</span><span style="color: #a31515;">Preloader</span>
<span style="color: red;">ID</span><span style="color: blue;">="ucPre"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: blue;">/></span>
</span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;"></</span><span style="color: #a31515; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">div</span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">></span></div>
<div class="MsoNormal">
<br /></div>
<span style="font-size: small;"></span>
<span style="font-size: medium;"><span style="font-family: "Trebuchet MS",sans-serif; font-size: 12pt;">Add this code above somewhere outside of the UpdatePanel. The purpose of this code – to show our progressinfo for our FullPostBack. I placed it above UpdatePanel. We will find this div by JavaScript and will show it. Yes, if you want you can find Preloader that is used by UpdatePanel inside. But I prefer to have separate div for this.</span></span><br />
<br />
<div class="MsoNormal">
<span style="font-size: 12pt; line-height: 115%;"><span style="font-size: 12pt;"><span style="font-family: "Trebuchet MS",sans-serif;">And add</span></span> </span><span style="color: green; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">OnClientClick="ShowProgress('divPreloader')" </span><span style="font-size: 12pt;"><span style="font-family: "Trebuchet MS",sans-serif; line-height: 115%;">to our </span></span><span style="color: blue; font-family: "Courier New"; font-size: 10pt; line-height: 115%;">btnWithPostBackTrigger.
</span><span style="font-size: 12pt;"><span style="font-family: Trebuchet MS,sans-serif; line-height: 115%;">ShowProgress – it is our
JavaScript function that will show what we need.</span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span style="font-size: 12pt;"><span style="line-height: 115%;">Code in .vb
file</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Courier New"; font-size: 10pt;">Private</span><span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;">Sub</span> Page_Load(sender <span style="color: blue;">As</span>
<span style="color: blue;">Object</span>, e <span style="color: blue;">As</span>
System.EventArgs) <span style="color: blue;">Handles</span> <span style="color: blue;">Me</span>.Load</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> <span style="color: blue;">Dim</span>
PageLoadedHandlerScript <span style="color: blue;">As</span> <span style="color: blue;">String</span> = <span style="color: #a31515;">" function
getObject (sId) { if(!sId) return null; else if (document.all &&
document.all[sId]) return
document.all[sId]; else if
(document.getElementById) return
document.getElementById(sId); else return null;}"</span> _</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> & <span style="color: #a31515;">"
function ShowProgress(sId) { var dP = getObject(sId); if (dP != null) {
dP.style.visibility = 'visible'; } }"</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;">
Page.ClientScript.RegisterClientScriptBlock(<span style="color: blue;">Me</span>.GetType,
<span style="color: #a31515;">"getObjectScript"</span>,
PageLoadedHandlerScript, <span style="color: blue;">True</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Courier New"; font-size: 10pt;"> btnWithPostBackTrigger.OnClientClick = <span style="color: #a31515;">"ShowProgress('divPreloader')"</span></span></div>
<div class="MsoNormal">
<span style="font-family: "Courier New"; font-size: 10pt; line-height: 115%;"><span style="color: blue;">End</span> <span style="color: blue;">Sub</span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-size: 12pt; line-height: 115%;">In this code we register our JavaScript on the page. There are two functions – the first function finds DOM element by id or name. The second function is our ShowProgress function that is used by btnWithPostBackTrigger. You can use your own JavaScript and jQuery if you need<span style="font-family: "Trebuchet MS",sans-serif;">.</span> </span></div>
<div class="MsoNormal">
<span style="font-size: 13.5pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="font-family: "Trebuchet MS",sans-serif;">
<span style="font-size: 12pt;"><span style="line-height: 115%;">That’s all.
Hope it will help you.</span></span></div>
<div class="MsoNormal">
<span style="font-size: 14pt; line-height: 115%;"></span></div>
<a href="http://www.lanteria.com/ForBlog/UpdatePanelProgressEmulation.zip" style="font-size: 14pt;"><span class="short_text" id="result_box" lang="en"><b>to sources >></b></span></a>Ivan Deynegahttp://www.blogger.com/profile/08029728050965950133noreply@blogger.com32tag:blogger.com,1999:blog-5815833303816855491.post-5111349483251669802012-02-22T17:43:00.000-05:002012-02-22T17:43:07.430-05:00The Safari’s and Chrome’s problems with Report Viewer 2010 + UpdatePanel + SharePoint 2010 or Uncaught Sys.ScriptLoadFailedException: Sys.ScriptLoadFailedException: The script '.....' could not be loaded. Uncaught TypeError: Cannot read property '_notified' of null.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;"><b>Initial data</b></span><br />
We have one WebPart for the SharePoint 2010. In this WebPart we have one UpdatePanel. In this UpdatePanel - Microsoft Report Viewer 2010 is placed.<br />
<br />
<span style="font-size: large;"><b>Situation</b></span><br />
MS Report Viewer works correct in the IE9.0 and in the Firefox. Report’s data being displayed correctly… But in the Chrome and in the Safari we have nothing. Well, we see NOT active Report Viewer, without any content. But if we remove UpadtePanel – all works good in all browsers. I was trying to reproduce this issue by base website created in the VS2010 (UpdatePanel + Report Viewer) – and again all was good. There was not any problems. But in the SharePoint2010 – no data in the ReportViewer.<br />
<br />
<span style="font-size: large;"><b>Investigation</b></span><br />
By the Chrome Dev Tool (F12) I found that the page had two JavaScript’s errors :<br />
<ol style="color: red; text-align: left;">
<li>Uncaught Sys.ScriptLoadFailedException: Sys.ScriptLoadFailedException: The script '....' could not be loaded. </li>
<li>Uncaught TypeError: Cannot read property '_notified' of null</li>
</ol>
<div style="text-align: left;">
And it was in the MicrosoftAjaxWebForms.js...</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-size: large;"><b>Solution</b></span><br />After internet’s revision I found that the same errors often occur in these browsers ( Safary and Chrome) if you use UpdatePanel/AjaxToolkit – all that uses ScriptManager. MicrosoftAjax in one word… it looks like the problem is in the following - MicrosoftAjaxWebForms.js don't define WebKit browsers correctly<br />If you add following code on the page - all works correctly :</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<br /><span style="color: blue;">Sys.Browser.WebKit = {};</span><br style="color: blue;" /><span style="color: blue;">if (navigator.userAgent.indexOf('WebKit/') > -1) {</span><br style="color: blue;" /><span style="color: blue;"> Sys.Browser.agent = Sys.Browser.WebKit;</span><br style="color: blue;" /><span style="color: blue;"> Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);</span><br style="color: blue;" /><span style="color: blue;"> Sys.Browser.name = 'WebKit';</span><br style="color: blue;" /><span style="color: blue;">} </span></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
It looks like that correct JavaScript is present for these browsers, but definer is not present. In any case these rows were solving my problems. But one question still present - why it was in the SharePoint2010 and was not present in the simple website created by VS2010… only one suggestion - different versions of the scripts for these products.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Hope it will help you.</div>
<div style="text-align: left;">
<br /></div>
</div>Ivan Deynegahttp://www.blogger.com/profile/08029728050965950133noreply@blogger.com25