Wednesday 30 January 2013

How to use Iframes in Sharepoint

1 - Add a content editor web part on to the page. To add a content editor web part
     Click on Web part -> Media and Content -> Content Editor -> OK.

2 - Click on Format Text -> HTML -> Edit Source tab in Ribbon.

3 - Add the following in the Source.
     <iframe width="420" height="315" src="http://sanjeetsatapathy.blogspot.com" frameborder="0"  allowfullscreen></iframe>
    Click ok.

4 - Click on Save to save your work. You will get your desired result.


Monday 28 January 2013

Enable Sync to SharePoint Workspace for SharePoint document libraries

We will be see how to enable Sync to SharePoint Workspace button in the ribbon interface for SharePoint document libraries so that the documents can be synced to SharePoint Workspace and the users can work from offline.

To enable Sync : 
1. Go to Shared Documents -> Library Settings -> General Settings -> Advanced Settings.

2. Click Yes in Office Client Availability section -> OK.

3. Sync to SharePoint Workspace option is enabled successfully.

Saturday 26 January 2013

LINQ to SQL Classes

LINQ to SQL classes that are mapped to database tables and views are called entity classes. The entity class maps to a record, whereas the individual properties of an entity class map to the individual columns that make up a record. Create entity classes that are based on database tables or views by dragging tables or views from Server Explorer/Database Explorer onto the Object Relational Designer (O/R Designer).



Demo :

1 - Open Visual Studio 2008 and create a new ASP.NET Web Application.
     File --> New --> Web Site --> Visual C# --> ASP.NET Web Application --> Give name of the  application (for Ex- LinqtoSqlClasses).

2 - Right-click on the "App_Data" folder and select Add --> New Item.

3 - Once the Add New Item windows opens select "LINQ to Sql Classes" and name it "Northwind.dbml" as follows:

4 - Now connect your Database in server explorer and drag and drop the tables to Northwind.dbml file. It will automatically converted into a class. See the image below.

   a) Click on server explorer.


    b) Click on connect to database.


      c) Enter credentials to connect to the database.

                
                     Click on OK button.

        d) Drag your table from server explorer and drop it to the dbml file.



               Press Ctrl+S to save your work.

    5 - Open your default.aspx page. Drag and drop grid view control from tool box menu on to the page.
   
    6 - Write the below code on the page load to fetch data from database.

           protected void Page_Load(object sender, EventArgs e)
          {
               if (!IsPostBack)
              {
                     Bind();
               }
          }

          private void Bind()
         {
               NorthwindDataContext db = new NorthwindDataContext();

               var category = from c in db.Categories
                                      select c;

               grdCategory.DataSource = category;
               grdCategory.DataBind();
         }
            
    7 - Save and run the application. You will get your required output.

          

Tuesday 15 January 2013

The current page has been customized from its template. Revert to template.


If you have customized a SharePoint 2010 aspx page by using SharePoint Designer, you may experience that when opening the modified webpage in your browser, that a yellow bar below the navigation bar will appear. This is not actually a error. This is a warning message.

To resolve this, you can use one of the below steps.

First Way :
Add the Css in the master page.
<style type="text/css">
body #pageStatusBar{height:0px; font-size:0px; padding:0px; border-style:none;}
</style>

2nd Way :
The following style attribute to the first DIV:
<div id="s4-statusbarcontainer" style="display: none">
<div id="pageStatusBar">
</div>
</div>

3rd Way :
Add the below code in the head section.

<head>
<title></title>
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(hideWarning, "SP.js");

function hideWarning() {
    var statusbarContainer = document.getElementById('s4-statusbarcontainer');    
    if (statusbarContainer != null) {  
       var messageSpan = document.getElementById('pageStatusBar');    
       if (messageSpan != null) {
           if (messageSpan.innerHTML.indexOf('The current page has been customized from its template.') == -1)
               statusbarContainer.style.display = 'inline';      
       else
       statusbarContainer.style.display = 'none';
}
    }
}
</script>

</script>
</head>

Wednesday 9 January 2013

The Site URL property of the project does not contain a valid URL

The Site URL property to which this error is referring can be found in the properties tool window when you have the project selected.  If you cannot see the properties tool window then you should be able to make it appear by hitting F4 or selected View > Properties Window from the menu.  From there, you just type the URL into the Site URL property and you should be good to go.

You must specify a value for this required field


If you are using a custom masterpage it is very common to use the visible="false" tag to hide element SharePoint is looking for but you don’t want displayed on your page.  If you did this with the PlaceHolderPageTitleInTitleArea tag at first glance everything works as it should.  However, you will notice that you can no longer save pages through the UI without getting the “You must specify a value for this required field” error.

To resolve this issue. Create a css class and call it.

.hide {
visibility: hidden;
}

Then wrap your PlaceHolderPageTitleInTitleArea in a <asp:Panel> tag that looks like this…

<asp:panel runat="server" cssclass="hide">
  <asp:contentplaceholder id="PlaceHolderPageTitleInTitleArea" runat="server" />
</asp:panel>