can not add webpart to sharepoint page - sharepoint

i create a website on my local machine but i can't add webpart to web page, it don't rise any error but th webpart don't display to the page. anyone help me.
Thanks

I know this is an old question, but it's ranking high in Google results, so I figured I'd answer it anyway.
Make sure you're not running any code in the layout page's codebehind that calls and then closes SPContext.Current.Web. I had this exact behavior and that was the culprit
To test, add a different web part to a default page layout. If it adds, then it's either your web part or your code behind. If you can't add any web parts to your custom layout, it's your code behind. If it's just your web part, it's your web part.
Remember, SPContext.Current.Web returns a reference to the current SPWeb object. SharePoint will close the object itself when it's done, and closing it early can cause "unpredictable behavior."

We had the same problem with Firefox some time ago, but the problem disappeared when we installed SP2 for SharePoint 2007. The only thing that surprises me is that you also have the problem with IE.

Related

error in sharepoint 2010 designer while saving:"Content in the embedded form may be changed by the the server to remove unsafe content. "

I am doing development in SharePoint 2010.
If I create a site page with the SharePoint look and feel for that site on save, I am getting this error:** "Content in the embedded form may be changed by the server to remove unsafe content. Do you want to reload your page to see the results of the save? "** and when I say reload, the server removes some parts of my page, e.g., onclick event of html, asp buttons.
I took a copy of 'How To Read Library' page just edited the text part of that page, and when I try to save this error again comes up.
However, if I create a simple aspx page with only html tags like head body, then there is no problem, everything works great. But SharePoint look and feel pages are giving troubles while saving.
Has anybody seen this previously? What could be the reason for this?
Which template did you use? I've had this same problem using the wiki site template, and found this link indicating you should use the blank site template:
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/af116ce7-ba3b-4722-9d5e-6321ea323448
However, I'd hope there's a better solution

SharePoint web part not displaying for site readers

I've built a custom SharePoint 2010 web part and deployed it to the home page of a publishing site. It's a very simple web part that just displays items from a SP list in a drop down list. The web part works fine if I'm logged in as a site owner or a member but not if I'm just a reader. The web part doesn't render at all to readers. I don't get any of the web part chrome or title, just nothing. I have other web parts (out-of-box ones) in the same zone that are displaying fine so it's not an issue of the whole zone not displaying.
As a reader, I can still view the list directly so it doesn't appear to be a problem with list permissions.
My web parts are being deployed as a farm solution, not sand-boxed and the assembly is being deployed to the GAC.
I feel like I must be missing something simple here but I'm stumped. Help.
Did you save / Check in the page after editing?
Regards,
Faiz
You may have to actually publish the page for a reader to see it

How to find missing web part?

Does anybody know how to find offending web part which causes this error ?
“A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe.”
I have inherited an old SharePoint 2003 portal site which uses custom web parts.
I know what this error means. I also know that each web part must be installed and registred as safe in web.config. The problem is that I don't know which one is missing.
I get same error when I'm trying to open the page in FrontPage as well.
Use contents=1 in QueryString to disable/remove WebParts from page that causes errors.
stsadm.exe -o enumallwebs -includewebparts
http://sharepointreporter.wordpress.com/
Requires updating to Sp2 I believe, for this command to be available. Problematic web parts will appear as 'Missing' in the resultant list.
Go to Event Viewer of the machine and you shall be able to see Error entries. Out of tons of entries you have to find out the entries related to you and you shall be able to see the names of the webparts that the sharepoint site is trying to load but fails. If you shall read the complete description of the error entry in the Event Viewer, it will give you version and even PublicKey Token of the webpart as well.
I hope this helps!!!
Try reading this:
http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=189
It should give you some clues to solving the problem. Essentially you have a control that is not marked as safe and it is failing. You can most likely config it to work, but the link above has other possible solutions.
in your url just append content=1. This will give you the all the webparts that are deployed. Now, you can keep deleting each of the webpart to find which one is causing issue ( ensure that you know to add the web parts back).
For example: if Url is http://localhost:9000/default.aspx, try with http://localhost:9000?contents=1
Alternatively, try to create a new webpart page,add web parts that are there on your actual page and check which one is causing issue. This will avoid changes to the actual page.
Hope this helps.
I've just suggested this same answer on MSDN:
This stsadm helped me in finding where the webpart was referenced in any way:
stsadm -o enumallwebs -includewebparts > C:\temp\somelog.txt
Then you can see the web part is listed under some <Web Id=... Url=...> XML node, i.e. you know the "culprit" web site.
At that point, some reasons I've found for those forgotten references:
the webpart is used in some sub-site of the culprit website, and the sub site is hidden from the quick list or top bar
the webpart has been deleted from the culprit website, but it still is in the "site collection recycle bin". You can reach that by going to the normal website recycle bin, then look for its link on the top bar description ("Use this page to restore items that..."). By the way, this site collection recycle bin has two views itself: be sure to check them both.
In both cases, I got some help by browsing the culprit website with SharePoint Manager. With that I could easily spot the existence of a forgotten subsite, as well as the existence of this "second level recycle bin".
HTH

Sharepoint WebPart not installing

What tips do you have for debugging a WebPart that is not installing? One tip per response.
One of the most common problems for newbies is probably code access security. A great article for troubleshooting this is Common Security Pitfalls for Web Part Developers by Jan Tielens. It was written for SharePoint 2003 / WSS 2.0 but the same principles apply in SharePoint 2007 / WSS 3.0.
The error is usually something like "A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe."
One Quick Solution I can think of seeing your Error message is that,you somewhere in the code have a <%%>. You can try wrapping that part with
<div id="temp" runat="server"> var x= '<% = x.ClientID %>' </div>
Sharepoint does not allow Inline scripting for any content except that in the _layouts folder out of the box. You need to move your inline code block to the code behind.
Put a breakpoint in the constructor and debug it. You probably don't want to do anything in the constructor. I think we may have been doing a RunWithElevatedPrivileges there and that was a problem when adding a web part to a page, but not using the web part if it was already on a page.
I am using webparts in sharepoint and I didn't find a way for debugging. I just copy the code into another application to debug it

OWA Web Part Jumps/Shifts when getting focus on My Site

In SharePoint (MOSS 2007), with an OWA web part on the page, either inbox or calendar parts, when a page loads it "jumps" down to have that part as the focus. No matter where it is on the page. Has anyone encountered this before or know how to solve this issue?
This happens on out of the box sharepoint sites, with the OWA components. No mofidications or 3rd party components or customizations are in play.
Thanks.
Its by default. The webparts are designed to get the focus when loaded.
Below might be solution/s using jQuery/JS:
Just create another webpart in the bottom (CE webpart just for adding JS) and add a JQUERY/JS code to scroll the page to top
Get to know the default JS function that's being called from the OWA webparts & override them in your custom JS
Nothing tested but normally this is how we prevent default behavior.

Resources