|
|
Comments and Discussions
|
|
 |

|
Nice article
|
|
|
|

|
In India is it possible for CEO to post this kind of core technical articles?
M.Sendilkumar
|
|
|
|

|
Hi,
Thank you for your idea,
I want to have a webpart with some user control.
i try to add a new webpart to my project and a new user control to skins.
but "generate web part " always get error (there is not and server tags).
could i add new skin (user control) to One web part? how?
it is important to me to have ONE .dll .
|
|
|
|

|
Hi
thank you for your article
i have VS2008 and MOSS 2007.
I deploy my webpart and deploy succeeded shown but when i goto moss site the web part is not added.
whats wrong?
|
|
|
|
|

|
Hi,
I believe i have followed the tutorial correctly but when i try add the web part to a page i receive an error Unable to add selected webpart and would appreciae it if someone is able to assist or send me an example VS2008 project so i can compare.
Thanks,
Mike
|
|
|
|

|
Hi Sasa.
This is a really great article.
When I try to deploy it I receive the error "object reference not set to an instance of an object". It doesn't give me a file or a line to check it out. I was wondering if you've seen this error before or if you knew a way of debugging it?
I use Visual Studio 2008 and the only thing different in my project than yours is that I also have two other files that you do not have in my folder "MyFirstSkinnedWebPart". There's "MyFirstSkinnedWebPart.webPart.webpart" and "MyFirstSkinnedWebPart.xml".
This is my code on MyFirstSkinnedWebPart.cs because it also looks a little different:
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using System.ComponentModel;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using ASPNETLibrary.SharePoint.WebParts;
namespace SampleWebParts
{
[XmlRoot(Namespace = "SampleWebParts")]
[GuidAttribute("42450357-ddce-47a2-8653-15c06eb40c36")]
[DefaultProperty("Text")]
[ToolboxData("<{0}:MyFirstSkinnedWebPart runat=server></{0}:MyFirstSkinnedWebPart>")]
public partial class MyFirstSkinnedWebPart : BaseSkinnedWebPart
{
#region [Methods]
protected override void Initialize(Control skin)
{
//TODO: add any extra initialization here (like attaching to Button.Click events,
//setting the initial data to server controls, etc)
this._button1.Click += new EventHandler(SubmitClick);
}
#endregion [Methods]
public MyFirstSkinnedWebPart()
{
this.ExportMode = WebPartExportMode.All;
}
void SubmitClick(object sender, EventArgs e)
{
this._label1.Text = "Hello World";
}
}
}
Thank you for taking a look at this.
-Harry
|
|
|
|

|
Hi,
I'd like to thank you first for great job you have done it in this add-in.
second, i have a problem generating the code from my user control, the error when click on generate button which i'm getting:
"Value can not be null, parameter name type".
How can i fix this ?
I'm using this addin with VS 2005 on my Virtual machine.
Regards,
Moustafa M.Arafa
|
|
|
|

|
Hello Moustafa,
Do you have at least one control with "runat='server'" and a valid ID? Did you try to put the HTML from my examples into your ASCX and did it work with that sample HTML?
Regards,
Sasa
|
|
|
|

|
Hi, Great work. realy a very nice idea. I have gone through all the steps but when i try to deploy the webpart the VS 2008 fails. Will you please help me in this regard. The error message that i am getting is in Danish. I dont know why is it in Danish.
The error message is
Kan ikke fuldføre denne handling. which means Can not complete this action. try again.
Thanks and realy a very nice article. 5/5 from my side
|
|
|
|

|
I'm glad that you like the idea.
Please try the following:
- right click on web part project and select Properties
- go through tabs and find a property that defines URL to web server (I don't have development environment with me and don't recall the name of the tab and property)
- set the property's value to URL of your MOSS website (for example, set it to "http://localhost" if you have MOSS running on default port and if you are testing with root website).
Let me know if that helped.
|
|
|
|

|
Yes, it worked thanks
so nice of you...
|
|
|
|

|
hi, Sorry to disturb you once again but when i am trying to add the control in my sharepoint cite it shows Unable to add selected web part(S) cannot import this web part
|
|
|
|

|
Hi,
I'm getting the same error "Unable to add Web part"
Had you found a solution for this
Blog: http://dotnetQPearl.com/blogs/ahmed_ramy/
WebSite:
http://AhmedRamy.com
|
|
|
|

|
I would suggest you check SafeControls section in web.config file and see if there is an entry as specified in this article.
Also check if the right DLLs are in Global Assembly Cache.
|
|
|
|

|
Hi there,
Great idea and really nice implementation. I started to do something similar but your implementation is really good and well structured. However I'm getting "Could not find skin: /Themes/default/Myskinwp.ascx" and can not get over it. Couple of things I notice: Themes library is not site specific so if you have it on site collection level it's try to pick up it first instead of /YourSite/Themes/. I'll try to use the source and try to debug it but if you have any idea why I'm getting "Could not find skin" it will be greatly appreciated.
Regards, Kosta
|
|
|
|

|
Hi Kosta,
Thank you.
You are right about the Themes document library, it is not site specific. It's just the way we decided to do it. There is an alternative and that is to use ASCX files from file system directly and to use XML configuration. I didn't write an article about that before but you can try to see how to use it by looking into source code.
If you made Themes document library in at site collection level and if you have "default" folder in it but you are still getting the "Could not find skin" error then please try next:
- Select "Modify Shared Web Part" option on your web part
- In list of themes select "default"
- In list of skins select the right skin/ASCX for your web part.
Let me know if that worked.
Regards,
Sasa
|
|
|
|

|
Hi Sasa,
I see your point about “use ASCX files from file system directly”.
In site collection scenario it fails on
(HostingEnvironment.VirtualPathProvider.FileExists(skinPath)) inside BaseSkinnedWebPart class because SkinPath returns /{0}/{1}/{2} and by default it’s /Themes/default/yourskin.ascx. In site collection case it’s should look like /sites/yourSiteCollectionName/Themes/default/ yourskin.ascx so above statement returns false. One of the solutions can be to make BaseSkinnedWebPartSettingsToolPart return full path to the skin.
Couple of other notes (my env is server 08 + VS08):
1. I tried to use you latest code but for some reason it’s failing on “ConfigHandler” singleton initianisation during runtime.I do not know why but during debug it’s never get’s there and fails on “WebPartSkin skin = ConfigHandler.Instance.GetSkin(this.ThemeName, this.SkinName);” inside BaseSkinnedWebPart, complaining that Instance is null. I have no idea why it’s happens. So I have to use one of the first revisions of the code.
2. In terms of installation of generator plug-in: on my env I notice that if during install you use “for all” option it’s failing to add that “generate” on your right click. So what worked for me was to install it to default location (VS05), use “make changes for you only” option and in VS08 add that path in Tools->Option->Environment->Ad-in/Macros Security. Only slight annoying thing that both VS now complain several times about something like “index is out of range” on the start.
I’m hope it’s all makes since and might be helpful for other people that come across that really good and super useful project.
Thank you,
Kosta.
|
|
|
|

|
Dear Sasa,
First of all I would like to say that you have made good job with this article and thank you for your help.
My problem is when I try to Gererate Sharepoit webpart by right click "Generate Sharepoint Webpart" filed is not appearing
I am using vs2008
Thanks in advance.
Lalith
modified on Tuesday, March 24, 2009 11:27 PM
|
|
|
|

|
Dear Lalith,
Do you get "Generate SharePoint WebPart" menu item when you right click on an ASCX file? If yes, do you get any error message when you click on that menu item.
Regards,
Sasa
|
|
|
|

|
Dear Sasa,
Yes I have clicked on ASCX file. Anyway, After add that Add-in by manually by selecting Tools->Options->Add-in/Macros Security and add the Add-In installed folder It was fixed.
Thanks for Reply
Lalith
|
|
|
|

|
Dear Sasa,
First of all I would like to say that you have made good job with this article and thank you for your help.
My problem is when I try to deploy solution I get this error: No sharepoint site exists at the specified URL.
Do you think that problem could be uploaded file in default folder?
I don't know what is the problem.
Thanks in advance.
Branislav Tosic
|
|
|
|

|
Branislav,
Right click on your web part project, select "Properties", go to "Debug" tab and check startup URL. It should point to a SharePoint website where you would like to deploy your web part(s). I guess you have a wrong URL there so that is why Visual Studio is reporting that "No SharePoint site exists at the specified URL" when it tries to deploy your solution.
Let me know if that didn't help.
Regards,
Sasa
|
|
|
|

|
Sasa,
thank you very very much for your help. It was succesfully deployed on SharePoint.
Another thing is that when I add webpart to SharePoint it says that webpart cannot be imported.
I think the problem lies in my configuration. I will try again from the start.
Thanks again.
Branislav Tošić
P.S.: puno ti hvala na pomoći. Ako imam nekih problema javiću se. Hvala još jednom.
|
|
|
|

|
Hi Sasa
I am running VS2008 and installed as instructed by changing the folder to 2008 instead of 2005
When I try to Generate Skinned WebPart I get the following error
Error: There are No Server Controls! Generation will Not be performed
There were also errors saying that coredefinitions.xsd could not be found in the xml/schemas directory for studio9.
Any ideas what may be wrong?
|
|
|
|

|
Hi,
You either didn't put any ASP.NET controls into your skin or you have a non valid XHTML skin file. Try adding at least one ASP.NET control (or HTML control) with runat="server" attribute first. If that doesn't help then try validating your HTML file to be sure that you properly closed all tags.
Let me know if that doesn't help and post the content of your skin so that I can see what is causing the error.
Regards,
Sasa
|
|
|
|

|
Hi Sasa
I have just reread the article and saw that you mention MOSS specificaly. I only have WSS is this likely to be the problem?
Thanks
Kevin
|
|
|
|

|
Hi Sasa
I have just re read the article and saw that you mention MOSS specificaly. I only have WSS. does this work for WSS?
Thanks
Kevin
|
|
|
|

|
Hi Kevin,
I didn't test it with WSS but it should work without any problems.
Did you check ASCX file? Are you still getting an error and if so, which one?
Regards,
Sasa
|
|
|
|

|
Hi,
Nothing more to add, really goor article ... I'm having some troubles with my VStudio instalation, but your work is more then helpfull...
Best regards,
A.
P.S.: Iako je internacinalni sajt, chestitam i na nashem jeziku.... mogucje je da ti postavim neko pitanje, kao pomocj i to... Pozdrav iz Madrida...
|
|
|
|

|
Hi Antonijo,
Thank you for your comment. I'm glad you found it helpful.
Feel free to contact me if you need help.
Regards,
Sasa
P.S. Nadam se da problem sa VisualStudio-om nema veze sa Add-In-om . Do sada niko nije prijavio nikakve probleme pa slobodno javi ako primetis neke probleme.
|
|
|
|

|
Hi,
No, no, the problem is not with your add-on, the problem is with my Visual Studio 2008 installation. I'm using the Proffesional Edition on a Virtual machine. I was not able to get this WebPart template in the VisualStudio. I have installed the latest updates and the extensions for the VStudio (extensions v1.1 and v1.2 also), thinking I will get them and make my life easier, but nothing yet...
So, I need some experiance talk here, any help would be welcomed...
Best regards, Antonijo
|
|
|
|
|

|
Hi again,
Exactly my case: virtual machine with Windows Server 2003 + Visual Studio 2008 Professional Edition + VisualStudio Extensions for SharePoint v1.2... and no result...
Any other idea?
Thanks in advance,
Antonijo
|
|
|
|

|
Antonijo,
Can you find "Extensions for SharePoint Svcs" (or similar) product in list of "Installed Products" when you open VisualStudio and select "Help ==> About Microsoft Visual Studio" in horizontal menu?
If you can see it then it means you installed it and they you should see "Web Part" in list of "Visual Studio installed templates" when you go to "File ==> New ==> Project" and click on "Visual C#" (for example).
Let me know what you saw on those screens.
Regards,
Sasa
|
|
|
|

|
Hi Sasha,
OK, I have it now. The problem was in the link for the VS2008 extensions v1.2, it is not installing correctly, but if You install all the templates for VS2008, then it works fine and I can now visualize the WebPart template now...
Thanks a lot for the help... now I will get a deeper look at your add-on...
Regards, A.
|
|
|
|

|
You are welcome. I wish you success!
|
|
|
|

|
Hi again,
Just one thing more, that I have noticed just before ending all the steps:
When I do right click over the skin/template, I don't get the option "Generate SharePoint WebPart" (image 19 - ScreenHunter_19.gif from your step by step tutorial). Any ideas why??
I have installed the add-in (SkinnedWebPartsGeneratorAddIn.msi) correctly.
Kind regards,
A.
P.S. Povezacju te na LinkedIn-u...
|
|
|
|

|
Did you install the Add-In? The link for download is available at the top of the page (http://www.codeproject.com/KB/sharepoint/webparts_generator_addin/SkinnedWebPartsGeneratorAddIn.zip[^]).
I'm not sure if you read comments below but for Visual Studio 2008 you will need to manually change target folder during installation of Add-In. If you didn't do that then I suggest you:
1. Close Visual Studio,
2. Uninstall the Add-In (Control Panel ==> Add/Remove Programs),
3. Start installation again and
4. Change "2005" into "2008" in folder path when asked to confirm/choose installation folder.
Let me know if that helped.
|
|
|
|
|

|
Great article.
I will just add one remark, when I started addin install, the setup proposed to install to VS2005 addins folder. I had to manually change 2005 into 2008 to install it for Visual Studio 2008.
|
|
|
|

|
Hi Stephen,
I'm glad that you liked the article.
Thank you for remark. We should make two installations - one per VisualStudio version.
Regards,
Sasa
|
|
|
|

|
Good work man
|
|
|
|

|
Mansaah,
Thank you very much!
It's great to hear that our hard work is appreciated by community.
Regards,
Sasa
|
|
|
|

|
Poruke (a i clanak) nisu bile javne... a sve sto od sad pa nadalje pisemo ce ostati generacijama u amanet (osim ako neko od nas ne obrise).
Imas kod slika jos neka mesta gde nije ubacen <br />... pretrazi clanak za ". You can optionally modify your project" pa ces da vidis. Ali da ne sitnicarimo (ono dodaj border 1 na slicice, napravi malo mesta izmedju njih i teksta... verovatno te mrzi da to doterujes)... clanak je sada javno vidljiv.
A za to da je kodiranje isplativije od pevaljki - sto rece onaj ludak iz Suntavila -> "Klintone, nema sanse"
Dobar clanak by the way... dobio si 5 od mene.
|
|
|
|

|
Predrag,
I'll write in English as this is an international website.
Thank you for all the useful comments. I'll try to make the article more readable in next few days.
Thx for the excellent mark
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A Visual Studio add-in that allows generation of Web Parts based on prepared ASCX controls/templates.
| Type | Article |
| Licence | CDDL |
| First Posted | 19 Jan 2009 |
| Views | 75,461 |
| Downloads | 513 |
| Bookmarked | 62 times |
|
|