Saturday, August 25, 2012

Adding Custom CSS style in Markup drop down of Sharepoint 2010 HTML editor ribbon




1. Create one css file in 14 hive(you can add it in your visual studio solution by adding layouts mapped folder)

2. add below css class in that file 

/* custom style in */
DIV.ms-rteElement-mkg-H1
{
-ms-name: "marketing-header";
color: #d65c26;
font-family: Verdana,Geneva,sans-serif;
font-weight: normal;
font-size: 2em;
}

Saturday, August 11, 2012

WCF with sharepoint 2010 service

Try below code, it works perfectly fine:-

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Linq;
using Microsoft.SharePoint.Linq;
using WCFService.ListWCFService;
namespace WCFService.WP_WCFService
{
    public partial class WP_WCFServiceUserControl : UserControl
    {
       
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }
        protected override void OnPreRender(EventArgs e)
        {
            try
            {
                System.Uri uri = new Uri("http://localhost:16178/_vti_bin/ListData.svc");
               SrgDataContext dc = new SrgDataContext(uri);
               dc.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    var query = from dev in dc.Announcements
                                select new
                                {
                                    Title = dev.Title,
                                    Body = dev.Body,
                                    ExpiryDate = dev.Expires,
                                    Path = dev.Path
                                };
                    gridAnnouncementList.DataSource = query;
                    gridAnnouncementList.DataBind();
             
                //dc.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
           

Using Sharepoint rich text box in Web Part

Just add below line in sharepoint project visual web part ascx file:-
<SharePoint:InputFormTextBox runat="server" ID="txtBody" TextMode="MultiLine" ValidationGroup="CreateCase" Rows="8" Columns="40" RichText="true" RichTextMode="FullHtml" AllowHyperlink="true" />

SharePoint document metadata not updating

I faced a weird issue today, Metadata for document which has lookup column was not updating even after saving the item. There was no erro...