Step1# Define Connection String that points to your database.
Step2# Define ConnectionStringName property of Defualt provider to your Connection String defined in step#1
step#3 If web parts are not working or throwing exception of Schema then use aspnet_regsql.exe to create schema(Tables and stored Procedures) by Asp.net so that data used for webparts is retrived and saved again in your define database.
Enjoy ;)
web.config --- Code
<appSettings/> <connectionStrings> <add name="LocalSqlServer1" connectionString="Data Source=server;Initial Catalog=database_rahim;User ID=rahim;Password=test/> </connectionStrings> <system.web> <webParts> <personalization defaultProvider="SqlPeronalizationProvider"> <providers> <add name="SqlPeronalizationProvider" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" connectionStringName="LocalSqlServer1" /> </providers> </personalization> </webParts>
This comment has been removed by the author.
ReplyDeleteif some one want to show the closed webparts on the page as a list simply do the following step (these are basic)
ReplyDelete1- Add CatelogZone control
2- Add CatelogPage Control in the above zone
3- then add mentioned below line on the page load or in button click event.
this.WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
Good work ! hira.
ReplyDeleteThis code basically get all of webparts in your page we can say catalog as a bucket of weparts
Hi Sir,
ReplyDeleteIts a very helpful post. What i learned was to make webparts from 'Web User Controls' that is .ascx file. And I did put the compiled dll in GAC and also edited the sharepoint site`s web.config file so that sharepoint could recognize me webpart as a safe control. It its not opening my control saying that its not safe. I also reduced the risk level of my site from low to medium (as mentioned in msdn). Please guide me in it.
Saad Ahmed Khan (CMS - PAF Kiet)