本文整理汇总了C#中System.Web.UI.WebControls.WebControl.RemoveCssClass方法的典型用法代码示例。如果您正苦于以下问题:C# WebControl.RemoveCssClass方法的具体用法?C# WebControl.RemoveCssClass怎么用?C# WebControl.RemoveCssClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.WebControl
的用法示例。
在下文中一共展示了WebControl.RemoveCssClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFollowing
/// <summary>
/// Configures a control to display and toggle following for the specified entity
/// </summary>
/// <param name="followEntity">The follow entity. NOTE: Make sure to use PersonAlias instead of Person when following a Person</param>
/// <param name="followControl">The follow control.</param>
/// <param name="follower">The follower.</param>
public static void SetFollowing( IEntity followEntity, WebControl followControl, Person follower )
{
var followingEntityType = EntityTypeCache.Read( followEntity.GetType() );
if ( follower != null && follower.PrimaryAliasId.HasValue )
{
using ( var rockContext = new RockContext() )
{
var personAliasService = new PersonAliasService( rockContext );
var followingService = new FollowingService( rockContext );
var followingQry = followingService.Queryable()
.Where( f =>
f.EntityTypeId == followingEntityType.Id &&
f.PersonAlias.PersonId == follower.Id );
followingQry = followingQry.Where( f => f.EntityId == followEntity.Id );
if ( followingQry.Any() )
{
followControl.AddCssClass( "following" );
}
else
{
followControl.RemoveCssClass( "following" );
}
}
int entityId = followEntity.Id;
// only show the following control if the entity has been saved to the database
followControl.Visible = entityId > 0;
string script = string.Format(
@"Rock.controls.followingsToggler.initialize($('#{0}'), {1}, {2}, {3}, {4});",
followControl.ClientID,
followingEntityType.Id,
entityId,
follower.Id,
follower.PrimaryAliasId );
ScriptManager.RegisterStartupScript( followControl, followControl.GetType(), "following", script, true );
}
}