本文整理汇总了C#中System.Web.UI.WebControls.LinkButton.AddCssClass方法的典型用法代码示例。如果您正苦于以下问题:C# LinkButton.AddCssClass方法的具体用法?C# LinkButton.AddCssClass怎么用?C# LinkButton.AddCssClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.LinkButton
的用法示例。
在下文中一共展示了LinkButton.AddCssClass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
_lbAddFamilyMember = new LinkButton();
Controls.Add( _lbAddFamilyMember );
_lbAddFamilyMember.ID = this.ID + "_btnAddFamilyMember";
_lbAddFamilyMember.Click += lbAddFamilyMember_Click;
_lbAddFamilyMember.AddCssClass( "add btn btn-action" );
_lbAddFamilyMember.CausesValidation = false;
var iAddFilter = new HtmlGenericControl( "i" );
iAddFilter.AddCssClass("fa fa-plus-circle");
_lbAddFamilyMember.Controls.Add( iAddFilter );
}
示例2: OnInit
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnInit( EventArgs e )
{
base.OnInit( e );
phExternalLogins.Controls.Clear();
// Look for active external authentication providers
foreach ( var serviceEntry in AuthenticationContainer.Instance.Components )
{
var component = serviceEntry.Value.Value;
if ( component.IsActive && component.RequiresRemoteAuthentication )
{
string loginTypeName = component.GetType().Name;
// Check if returning from third-party authentication
if ( !IsPostBack && component.IsReturningFromAuthentication( Request ) )
{
string userName = string.Empty;
string returnUrl = string.Empty;
if ( component.Authenticate( Request, out userName, out returnUrl ) )
{
LoginUser( userName, returnUrl, false );
break;
}
}
LinkButton lbLogin = new LinkButton();
phExternalLogins.Controls.Add( lbLogin );
lbLogin.AddCssClass( "btn btn-authenication " + loginTypeName.ToLower() );
lbLogin.ID = "lb" + loginTypeName + "Login";
lbLogin.Click += lbLogin_Click;
lbLogin.CausesValidation = false;
if ( !String.IsNullOrWhiteSpace( component.ImageUrl() ) )
{
HtmlImage img = new HtmlImage();
lbLogin.Controls.Add( img );
img.Attributes.Add( "style", "border:none" );
img.Src = Page.ResolveUrl( component.ImageUrl() );
}
else
{
lbLogin.Text = "Login Using " + loginTypeName;
}
}
}
}
示例3: OnInit
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
protected override void OnInit( EventArgs e )
{
base.OnInit( e );
btnNewAccount.Visible = !GetAttributeValue( "HideNewAccount" ).AsBoolean();
phExternalLogins.Controls.Clear();
int activeAuthProviders = 0;
var selectedGuids = new List<Guid>();
GetAttributeValue( "RemoteAuthorizationTypes" ).SplitDelimitedValues()
.ToList()
.ForEach( v => selectedGuids.Add( v.AsGuid() ) );
// Look for active external authentication providers
foreach ( var serviceEntry in AuthenticationContainer.Instance.Components )
{
var component = serviceEntry.Value.Value;
if ( component.IsActive &&
component.RequiresRemoteAuthentication &&
selectedGuids.Contains( component.EntityType.Guid ) )
{
string loginTypeName = component.GetType().Name;
// Check if returning from third-party authentication
if ( !IsPostBack && component.IsReturningFromAuthentication( Request ) )
{
string userName = string.Empty;
string returnUrl = string.Empty;
if ( component.Authenticate( Request, out userName, out returnUrl ) )
{
LoginUser( userName, returnUrl, false );
break;
}
}
activeAuthProviders++;
LinkButton lbLogin = new LinkButton();
phExternalLogins.Controls.Add( lbLogin );
lbLogin.AddCssClass( "btn btn-authenication " + loginTypeName.ToLower() );
lbLogin.ID = "lb" + loginTypeName + "Login";
lbLogin.Click += lbLogin_Click;
lbLogin.CausesValidation = false;
if ( !string.IsNullOrWhiteSpace( component.ImageUrl() ) )
{
HtmlImage img = new HtmlImage();
lbLogin.Controls.Add( img );
img.Attributes.Add( "style", "border:none" );
img.Src = Page.ResolveUrl( component.ImageUrl() );
}
else
{
lbLogin.Text = loginTypeName;
}
}
}
// adjust the page if there are no social auth providers
if ( activeAuthProviders == 0 )
{
divSocialLogin.Visible = false;
divOrgLogin.RemoveCssClass( "col-sm-6" );
divOrgLogin.AddCssClass( "col-sm-12" );
}
}
示例4: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
_lbAddGroupMember = new LinkButton();
Controls.Add( _lbAddGroupMember );
_lbAddGroupMember.ID = this.ID + "_btnAddGroupMember";
_lbAddGroupMember.Click += lbAddGroupMember_Click;
_lbAddGroupMember.AddCssClass( "add btn btn-xs btn-action" );
_lbAddGroupMember.CausesValidation = false;
var iAddFilter = new HtmlGenericControl( "i" );
iAddFilter.AddCssClass("fa fa-user");
_lbAddGroupMember.Controls.Add( iAddFilter );
var spanAddFilter = new HtmlGenericControl("span");
spanAddFilter.InnerHtml = " Add Person";
_lbAddGroupMember.Controls.Add( spanAddFilter );
}
示例5: CreateControls
//.........这里部分代码省略.........
contactInfoRow.Email = groupMember.Person.Email;
if ( setSelection )
{
if ( groupMember.Person != null )
{
groupMemberRow.TitleValueId = groupMember.Person.TitleValueId;
groupMemberRow.FirstName = groupMember.Person.FirstName;
groupMemberRow.LastName = groupMember.Person.LastName;
groupMemberRow.SuffixValueId = groupMember.Person.SuffixValueId;
groupMemberRow.Gender = groupMember.Person.Gender;
groupMemberRow.BirthDate = groupMember.Person.BirthDate;
groupMemberRow.ConnectionStatusValueId = groupMember.Person.ConnectionStatusValueId;
groupMemberRow.GradeOffset = groupMember.Person.GradeOffset;
}
}
foreach ( var attributeControl in attributeControls )
{
var attributeRow = new NewGroupAttributesRow();
attributeControl.Controls.Add( attributeRow );
attributeRow.ID = string.Format( "{0}_{1}", attributeControl.ID, groupMemberGuidString );
attributeRow.AttributeList = attributeControl.AttributeList;
attributeRow.PersonGuid = groupMember.Person.Guid;
attributeRow.PersonName = groupMember.Person.FullName;
if ( setSelection )
{
attributeRow.SetEditValues( groupMember.Person );
}
}
if ( Duplicates.ContainsKey( groupMember.Person.Guid ) )
{
var dupRow = new HtmlGenericControl( "div" );
dupRow.AddCssClass( "row" );
dupRow.ID = string.Format( "dupRow_{0}", groupMemberGuidString );
phDuplicates.Controls.Add( dupRow );
var newPersonCol = new HtmlGenericControl( "div" );
newPersonCol.AddCssClass( "col-md-6" );
newPersonCol.ID = string.Format( "newPersonCol_{0}", groupMemberGuidString );
dupRow.Controls.Add( newPersonCol );
newPersonCol.Controls.Add( PersonHtmlPanel(
groupMemberGuidString,
groupMember.Person,
groupMember.GroupRole,
location,
rockContext ) );
LinkButton lbRemoveMember = new LinkButton();
lbRemoveMember.ID = string.Format( "lbRemoveMember_{0}", groupMemberGuidString );
lbRemoveMember.AddCssClass( "btn btn-danger btn-xs" );
lbRemoveMember.Text = "Remove";
lbRemoveMember.Click += lbRemoveMember_Click;
newPersonCol.Controls.Add( lbRemoveMember );
var dupPersonCol = new HtmlGenericControl( "div" );
dupPersonCol.AddCssClass( "col-md-6" );
dupPersonCol.ID = string.Format( "dupPersonCol_{0}", groupMemberGuidString );
dupRow.Controls.Add( dupPersonCol );
var duplicateHeader = new HtmlGenericControl( "h4" );
duplicateHeader.InnerText = "Possible Duplicate Records";
dupPersonCol.Controls.Add( duplicateHeader );
foreach( var duplicate in Duplicates[groupMember.Person.Guid] )
{
GroupTypeRole groupTypeRole = null;
Location duplocation = null;
var dupGroupMember = groupMemberService.Queryable()
.Where( a => a.PersonId == duplicate.Id )
.Where( a => a.Group.GroupTypeId == _groupType.Id )
.Select( s => new
{
s.GroupRole,
GroupLocation = s.Group.GroupLocations.Where( a => a.GroupLocationTypeValue.Guid.Equals( _locationType.Guid ) ).Select( a => a.Location ).FirstOrDefault()
} )
.FirstOrDefault();
if ( dupGroupMember != null )
{
groupTypeRole = dupGroupMember.GroupRole;
duplocation = dupGroupMember.GroupLocation;
}
dupPersonCol.Controls.Add( PersonHtmlPanel(
groupMemberGuidString,
duplicate,
groupTypeRole,
duplocation,
rockContext ) );
}
}
}
ShowPage();
}
示例6: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
_noteNew = new NoteControl();
_noteNew.ID = "noteNew";
_noteNew.SaveButtonClick += note_SaveButtonClick;
Controls.Add( _noteNew );
_lbShowMore = new LinkButton();
_lbShowMore.ID = "lbShowMore";
_lbShowMore.Click += _lbShowMore_Click;
_lbShowMore.AddCssClass( "load-more btn btn-xs btn-action" );
Controls.Add( _lbShowMore );
var iDownPre = new HtmlGenericControl( "i" );
iDownPre.Attributes.Add( "class", "fa fa-angle-down" );
_lbShowMore.Controls.Add( iDownPre );
var spanDown = new HtmlGenericControl( "span" );
spanDown.InnerHtml = " Load More ";
_lbShowMore.Controls.Add( spanDown );
var iDownPost = new HtmlGenericControl( "i" );
iDownPost.Attributes.Add( "class", "fa fa-angle-down" );
_lbShowMore.Controls.Add( iDownPost );
}
示例7: SetCssClass
private void SetCssClass(LinkButton button, OrderBy orderBy)
{
button.CssClass = "";
if (orderBy.IsCurrent()) button.AddCssClass("current");
button.AddCssClass(orderBy.IsAsc() ? "sort-up" : "sort-down");
}
示例8: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
toggleAllAny = new Toggle();
Controls.Add( toggleAllAny );
toggleAllAny.ID = this.ID + "_toggleAllAny";
toggleAllAny.ButtonSizeCssClass = "btn-xs";
toggleAllAny.OnText = "All";
toggleAllAny.OffText = "Any";
toggleAllAny.ActiveButtonCssClass = "btn-info";
btnAddGroup = new LinkButton();
Controls.Add( btnAddGroup );
btnAddGroup.ID = this.ID + "_btnAddGroup";
btnAddGroup.Click += btnAddGroup_ServerClick;
btnAddGroup.AddCssClass( "btn btn-action" );
btnAddGroup.CausesValidation = false;
var iAddGroup = new HtmlGenericControl( "i" );
iAddGroup.AddCssClass( "fa fa-list-alt" );
btnAddGroup.Controls.Add( iAddGroup );
btnAddGroup.Controls.Add( new LiteralControl( " Add Filter Group" ) );
btnAddFilter = new LinkButton();
Controls.Add( btnAddFilter );
btnAddFilter.ID = this.ID + "_btnAddFilter";
btnAddFilter.Click += btnAddFilter_ServerClick;
btnAddFilter.AddCssClass( "btn btn-action" );
btnAddFilter.CausesValidation = false;
var iAddFilter = new HtmlGenericControl( "i" );
iAddFilter.AddCssClass( "fa fa-filter" );
btnAddFilter.Controls.Add( iAddFilter );
btnAddFilter.Controls.Add( new LiteralControl( " Add Filter" ) );
lbDelete = new LinkButton();
Controls.Add( lbDelete );
lbDelete.ID = this.ID + "_lbDelete";
lbDelete.Click += lbDelete_Click;
lbDelete.AddCssClass( "btn btn-xs btn-danger" );
lbDelete.CausesValidation = false;
var iDeleteGroup = new HtmlGenericControl( "i" );
iDeleteGroup.AddCssClass( "fa fa-times" );
lbDelete.Controls.Add( iDeleteGroup );
}
示例9: InstantiateIn
/// <summary>
/// When implemented by a class, defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
/// </summary>
/// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
public void InstantiateIn( Control container )
{
DataControlFieldCell cell = container as DataControlFieldCell;
if ( cell != null )
{
DeleteField deleteField = cell.ContainingField as DeleteField;
ParentGrid = deleteField.ParentGrid;
LinkButton lbDelete = new LinkButton();
lbDelete.CausesValidation = false;
lbDelete.CssClass = deleteField.ButtonCssClass;
lbDelete.PreRender += ( s, e ) =>
{
if ( lbDelete.Enabled && ( !ParentGrid.Enabled || !ParentGrid.IsDeleteEnabled ) )
{
lbDelete.AddCssClass( "disabled" );
lbDelete.Enabled = false;
}
};
lbDelete.ToolTip = deleteField.Tooltip;
HtmlGenericControl buttonIcon = new HtmlGenericControl( "i" );
buttonIcon.Attributes.Add( "class", deleteField.IconCssClass );
lbDelete.Controls.Add( buttonIcon );
lbDelete.Click += lbDelete_Click;
lbDelete.DataBinding += lbDelete_DataBinding;
// make sure delete button is registered for async postback (needed just in case the grid was created at runtime)
var sm = ScriptManager.GetCurrent( this.ParentGrid.Page );
sm.RegisterAsyncPostBackControl( lbDelete );
cell.Controls.Add( lbDelete );
}
}