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
}
}
}