There are two ways to create sharepoint web parts. once is visual webpart another one is normal web part.
Since we all know the difference between those two , there are no point of covering about that here.
But the question is, how can we hide entire web part when the time comes? There are two ways to hide it. one is client side scripting another one is server side coding.
Client side script to hide (Javascript)
Hide the webpart which is create as normal web part in sharepoint
HTML Content of that web part.
<div id=""div1"">
<div id=""div2"" class = ""user-profile-wp-header"">
</div>
<div id=""div3"">
<div id='div4' class=""recom-nav-next"">
</div>
</div>
<div id=""div5"">
</div>
</div>
This web part can be hide using javascript. get the outerwrap div id and use it to hide that webpart, or else get the webpart ID using sharepoint designer then use that id instead of outer div Id.
You can use this javascript to hide,
$('#div1').hide();
Server side code (C#)
You can hide the entire web part in page load method ( or can be anywhere) if it is a visual web part.
protected void Page_Load(object sender, EventArgs e)
{
this.ChromeType = PartChromeType.None;
this.Hidden = true;
}
Since we all know the difference between those two , there are no point of covering about that here.
But the question is, how can we hide entire web part when the time comes? There are two ways to hide it. one is client side scripting another one is server side coding.
Client side script to hide (Javascript)
Hide the webpart which is create as normal web part in sharepoint
HTML Content of that web part.
<div id=""div1"">
<div id=""div2"" class = ""user-profile-wp-header"">
</div>
<div id=""div3"">
<div id='div4' class=""recom-nav-next"">
</div>
</div>
<div id=""div5"">
</div>
</div>
This web part can be hide using javascript. get the outerwrap div id and use it to hide that webpart, or else get the webpart ID using sharepoint designer then use that id instead of outer div Id.
You can use this javascript to hide,
$('#div1').hide();
Server side code (C#)
You can hide the entire web part in page load method ( or can be anywhere) if it is a visual web part.
protected void Page_Load(object sender, EventArgs e)
{
this.ChromeType = PartChromeType.None;
this.Hidden = true;
}