Monday, November 23, 2009

Customizing Toolpart (Toolpane) of Webpart In SharePoint

i have go a call form one of my friends regarding customizing the Toolpart of sharepoint webpart,as i mostly use Return of Smartpart for Webpart development so i didnt have any idea about it, then i went to my best frined Google.com and got hell alot of results on customizing toolpart ,
the best and easy one was by Liam , in his two parts of tutorial he has given very simple logic for developing a custom toolpane webpart part1 , part 2.
Now this blog just display how to add contents to the webpart's toolpart , but how to add functiolity and pass the value from Toolpart to you webpart page. hmmm thats a good question , that is even very easy .

u just need to create property in Webpart class , just use that property in Toolpart and on apply change() method just pass the corresponding values to the webpart and can perform ur required


// webpart calss file
namespace ToolPartPrograming
{
public class ToolPartExample1 : Microsoft.SharePoint.WebPartPages.WebPart
{
public ToolPartExample1()
{
}

private string ddlValue;

public string DdlValue
{
get { return ddlValue; }
set { ddlValue = value; }
}


protected override void RenderContents(HtmlTextWriter writer)
{
base.RenderContents(writer);
writer.Write("The value selected in DropDownlist is " + DdlValue);
}

}
}


//Toolpartclass file , must be written in different class file
namespace ToolPartPrograming
{
class ToolpartClass : Microsoft.SharePoint.WebPartPages.ToolPart
{
public override void ApplyChanges()
{
ToolPartExample1 objTP1 = new ToolPartExample1();
objTP1.DdlValue =ddlDropDown.SelectedValue; //Pass the value this ddl is bounded with Toolpart
}

}
}



Friday, August 28, 2009

SPEmailEvent Handler not firing

I was suffering from this problem that my email event handler was not firing up. i work around then foounf out that i have to go for infrastrusture updates for the SharePoint. and then it worked find,
but later i hv faced one big problem , that when i was updating my code . it was not working , it was not getting refacted . after running trhough i came to know that the sharepoint code which runs under sharepoint timer job , dont take new code untill you either restart the timer of sharepoint or create new version of dll and deploye in to the GAC,
so if you are facing this kind of problem the folllowo the process.
it holds good for the Workflows if you have used Timer event in it .

Use Command
Net stop sptimerv3
Net start sptimerv3

this will reset the timer and the new code will be in effect

Monday, February 2, 2009

Should not Use SPUser variable in Wokflow

Hi if Error
" Could not create activity of type 'MXKnowldgeObjectWorkflow.Workflow1'. System.NullReferenceException: Object reference not set to an instance of an object.
at MXKnowldgeObjectWorkflow.Workflow1..ctor() C:\Documents and Settings\Administrator.MOSS\My Documents\Vikash\MXKnowldgeObjectWorkflow\MXKnowldgeObjectWorkflow " The Compile Time Error , so just remove the SPUser variable form your workflow Code and to find the Current Person in the Workflow use the follwoing code snippit
i got this code from the Net , i'll let u know abuot the devlopper who has given this code

private string GetTheCurrentUser()
{
string ModifiedbyUserName = Convert.ToString(workflowProperties.Item.GetFormattedValue("Modified By"));
string[] strChar = { "ID=" };

string[] strChars = ModifiedbyUserName.Split(strChar, StringSplitOptions.None);

Int32 iUserID = Convert.ToInt32(strChars[1].Substring(0, strChars[1].IndexOf("\"")));
return iUserID.ToString();
}

Thursday, January 15, 2009

SharePoint and We

HI
Can any one tell me how to customize a content query webpart to Access The List Items of The SharePonit List ?

Thanks and Regards
Vikash Kumar Sharma