Showing posts with label SharePoint Design. Show all posts
Showing posts with label SharePoint Design. Show all posts

Thursday, January 17, 2008

Printing SharePoint Web Part

Ever thought of printing a content of web part rather than complete page in sharepoint ?

Follow the Steps:

  • Create Print Button : Add content Editor web part to your page and paste the following script as Source Text


<>
< type="button" onclick="javascript:void(PrintWebPart())" value="Print Web Part">

< language="JavaScript">
//Controls which Web Part or zone to print
var WebPartElementID = "WebPartWPQ6";

//Function to print Web Part

function PrintWebPart()
{
var bolWebPartFound = false;
if (document.getElementById != null)
{
//Create html to print in new window var PrintingHTML = '\n\n';
//Take data from Head Tag if (document.getElementsByTagName != null)
{
var HeadData= document.getElementsByTagName("HEAD");
if (HeadData.length > 0)
PrintingHTML += HeadData[0].innerHTML;
}
PrintingHTML += '\n\n\n';
var WebPartData = document.getElementById(WebPartElementID);
if (WebPartData != null)
{
PrintingHTML += WebPartData.innerHTML;
bolWebPartFound = true;
}
else
{ bolWebPartFound = false; alert ('Cannot Find Web Part'); } } PrintingHTML += '\n\n'; //Open new window to print if (bolWebPartFound)
{
var PrintingWindow = window.open("","PrintWebPart", "toolbar,width=800,height=600,scrollbars,resizable,menubar"); PrintingWindow.document.open(); PrintingWindow.document.write(PrintingHTML); // Open Print Window PrintingWindow.print(); }}< /script>

  • In order to print content from web part you need to connect the desired web part to the print button
  • Get the Div Id of web part from the Page Source and assign it to the variable in Button

Well you would like to check this for simpler explanation :

http://www.imakenews.com/mernstmann/e_article000435389.cfm

Friday, October 05, 2007

CSS not working on LinkButton

This was my issue , i had defined link button in asp.net like this :


_linkNewIncident = new System.Web.UI.WebControls.LinkButton();
_linkNewIncident.Text = "Creat New Incident";
_linkNewIncident.Click += new EventHandler(linkNewIncident_Click);
_linkNewIncident.CssClass = "HelpDeskLink";

and corresponding CSS as :
.HelpDeskLink { color:white ; font-weight :bolder ; font-size :x-small ; }

.HelpDeskLink a { color:white ; font-weight :bolder ; font-size :x-small ; }


when i ran the application , my links were still blue and was not reflecting any CSS behaviour which is supposed to be white as per my CSS :-(


After some search i got the solution .

Solution : Define "CSS Pseudo-classes"

I modified my CSS style class to the following and it worked ..


a.HelpDeskLink:link
{
color:white ;
font-weight :bolder ;
font-size :x-small ;
}

Wednesday, December 20, 2006

Adding additional Web Part Zone in SharePoint 2007 Page

Simple Steps:

  • Open SharePoint website using SharePoint Designer 2007
  • Open the desired page where you need additional “WebPart Zones”
  • Web parts zones needs to be defined in Content Placeholders .Make sure you have corresponding placeholders in Master page .
  • Add the following line at desired content placeholder of your page :

    < runat="server" frametype="TitleBarOnly" id="Left" title="loc:Left">
    <>
    < /ZoneTemplate>
    < /WebPartPages:WebPartZone >

    If you need more Web Part Zones Replicate the above code and change the "Title" and "ID" attribute.



  • Gray Failures: What is it and how to detect one?

    If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures.  Hopefu...