To set the Custom Properties of web part programmatically, Following approach is useful.
if (string.Equals(webPart.GetType().ToString(), “MyWebpartram001”))
{
PropertyInfo[] pinProperties = webPart.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo pinProperty in pinProperties)
{
if (pinProperty.Name == "Toolbar")
{
pinProperty.SetValue(webPart, false, null);
break;
}
}
}
****** HAPPY CODING ********
No comments:
Post a Comment