本文整理汇总了C#中System.Web.UI.WebControls.LinkButton类的典型用法代码示例。如果您正苦于以下问题:C# LinkButton类的具体用法?C# LinkButton怎么用?C# LinkButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkButton类属于System.Web.UI.WebControls命名空间,在下文中一共展示了LinkButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BindPager
public void BindPager()
{
panelPager.Controls.Clear();
var manager = new NotesManagerBusinessLogic();
var countOfNotes = manager.GetNotesCount();
var countOfPages = countOfNotes%10 == 0 ? countOfNotes/10 : countOfNotes/10 + 1;
if(countOfPages <= 1)
return;
for (var i = 1; i < countOfPages + 1; i++)
{
_linkButton = new LinkButton {ID = LinkId + i, Text = i.ToString()};
if (CurrentPage == i)
_linkButton.BackColor = Color.DarkGray;
PanelPager.Controls.Add(_linkButton);
var spacer = new Label { Text = " " };
PanelPager.Controls.Add(spacer);
}
}
开发者ID:13vidocq13,项目名称:minicms,代码行数:26,代码来源:PagerControl.ascx.cs
示例2: Page_Init
protected void Page_Init(object sender, EventArgs e)
{
BlogCategoryDAL categoryDAL = new BlogCategoryDAL();
BlogEntryDAL entryDAL = new BlogEntryDAL();
//setup the accordion
this.Accordion.Panes.Clear();
foreach (BlogCategory category in categoryDAL.ReadBlogCategory(BlogTopic))
{
AjaxControlToolkit.AccordionPane pane = new AjaxControlToolkit.AccordionPane();
pane.ID = "pane" + category.Id;
LiteralControl header = new LiteralControl(string.Format("<div class = \"MenuHeader\"><b>{0}</b></div>", category.Category));
pane.HeaderContainer.Controls.Add(header);
pane.ContentContainer.Controls.Add(new LiteralControl("<ul style='margin-top:0; margin-bottom:0'>"));
foreach (BlogEntry entry in entryDAL.GetBlogEntries(category.Id))
{
LinkButton linkButton = new LinkButton();
linkButton.ID = "linkButton" + entry.Id;
linkButton.Text = entry.Subject;
linkButton.CommandArgument = entry.Id.ToString();
linkButton.Command += new CommandEventHandler(linkButton_Command);
linkButton.CausesValidation = false;
linkButton.CssClass = "MenuButton";
pane.ContentContainer.Controls.Add(new LiteralControl("<li>"));
pane.ContentContainer.Controls.Add(linkButton);
pane.ContentContainer.Controls.Add(new LiteralControl("</li>"));
}
pane.ContentContainer.Controls.Add(new LiteralControl("</ul>"));
this.Accordion.Panes.Add(pane);
}
}
开发者ID:blel,项目名称:ebalit,代码行数:33,代码来源:CategoryBrowser.ascx.cs
示例3: InstantiateIn
public void InstantiateIn(Control objContainer)
{
LinkButton lnkbtn = new LinkButton();
lnkbtn.CommandName = strCommandName;
lnkbtn.DataBinding += new EventHandler(lnkbtn_DataBinding);
objContainer.Controls.Add(lnkbtn);
}
开发者ID:bsimser,项目名称:spforums,代码行数:7,代码来源:DataGridRT.cs
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LinkButton child = new LinkButton();
child.Text = "All";
child.CssClass = "noUnderLine";
child.Font.Bold = true;
//child.Click += new EventHandler(this.btnAlpha_Click);
this.phdAlphaBar.Controls.Add(child);
char ch = 'A';
for (int i = 0; i < 26; i++)
{
Label label = new Label();
label.Text = " | ";
this.phdAlphaBar.Controls.Add(label);
LinkButton button2 = new LinkButton();
button2.Text = Convert.ToChar((int)(ch + i)).ToString();
button2.CssClass = "noUnderLine";
button2.Font.Bold = true;
//button2.Click += new EventHandler(this.btnAlpha_Click);
this.phdAlphaBar.Controls.Add(button2);
}
}
}
开发者ID:wjkong,项目名称:MicNets,代码行数:25,代码来源:ctlAlphaBar.ascx.cs
示例5: BuildStudentProspectTable
public static void BuildStudentProspectTable(Table table, string userId)
{
GroupService service = new GroupService();
DataTable dtProspects = service.GetProspectiveStudentsData(userId);
DataTable dtGroups = service.GetSupervisorOfData(userId);
for (int i = 0; i < dtProspects.Rows.Count; i++)
{
DropDownList ddlGroupList = new DropDownList();
ddlGroupList.DataSource = dtGroups;
ddlGroupList.DataTextField = "GroupName";
ddlGroupList.DataValueField = "GroupId";
ddlGroupList.DataBind();
ddlGroupList.Items.Insert(0, "Add a group");
string name = dtProspects.Rows[i].ItemArray[0].ToString();
string id = dtProspects.Rows[i].ItemArray[1].ToString();
LinkButton b = new LinkButton();
b.Text = name;
b.CommandArgument = id;
b.CommandName = name;
TableRow row = new TableRow();
TableCell cellProspects = new TableCell();
TableCell cellGroups = new TableCell();
cellProspects.Controls.Add(b);
cellGroups.Controls.Add(ddlGroupList);
row.Cells.Add(cellProspects);
row.Cells.Add(cellGroups);
table.Rows.Add(row);
}
}
开发者ID:JamesWClark,项目名称:Strikethrough,代码行数:34,代码来源:GroupFactory.cs
示例6: OnBubbleEvent
/// <summary>
/// Captures a Delete command from a command button within the ListView. This code
/// assumes that each row contains a checkbox with an ID set to 'chkDelete'.
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
/// <returns></returns>
protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is CommandEventArgs)
{
switch (((CommandEventArgs) e).CommandName)
{
case "Delete":
bool result = false;
// loop through rows and delete item if checkbox is checked
foreach (ListViewDataItem listViewDataItem in Items)
{
CheckBox deleteCheckBox = listViewDataItem.FindControl("chkDelete") as CheckBox;
if (deleteCheckBox != null)
{
result = true;
if (deleteCheckBox.Checked)
DeleteItem(listViewDataItem.DisplayIndex);
}
}
if (result)
return true;
break;
case "Sort":
_sortButton = source as LinkButton;
break;
}
}
return base.OnBubbleEvent(source, e);
}
开发者ID:dpawatts,项目名称:zeus,代码行数:37,代码来源:ExtendedListView.cs
示例7: TodoGridView_RowDataBound
protected void TodoGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (IsPostBack)
{
if (e.Row.RowType == DataControlRowType.Header) //if header row has been clicked
{
LinkButton linkButton = new LinkButton();
for (int index = 0; index < TodoGridView.Columns.Count; index++)
{
if (TodoGridView.Columns[index].SortExpression == Session["SortColumn"].ToString())
{
if (Session["SortDirection"].ToString() == "ASC")
{
linkButton.Text = " <i class = 'fa fa-caret-up fa-lg'></i>";
}
else
{
linkButton.Text = " <i class = 'fa fa-caret-down fa-lg'></i>";
}
e.Row.Cells[index].Controls.Add(linkButton);
}
}
}
}
}
开发者ID:200275643,项目名称:COMP2007-S2016-MidTerm-200275643,代码行数:28,代码来源:TodoList.aspx.cs
示例8: InitializeSkin
protected override void InitializeSkin(System.Web.UI.Control Skin)
{
repeater1 = (RepeaterPaged)Skin.FindControl("repeater1");
TextBox1 = (TextBox)Skin.FindControl("TextBox1");
LinkButton1 = (LinkButton)Skin.FindControl("LinkButton1");
LinkButton1.Click += new EventHandler(LinkButton1_Click);
DataBind();
if (blogContext.ID != -1)
{
if (BView_WeblogThemeCssFile.CheckExist(blogContext.ID))
{
if (!BWeblog_UserCss.CheckHasCssFile(blogContext.BlogUserId))
{
Weblog_UserCss WUC = new Weblog_UserCss();
WUC.UserCss_CssFileId = blogContext.ID;
WUC.UserCss_UserId = blogContext.BlogUserId;
WUC.UserCss_Used = true;
BWeblog_UserCss.Insert(WUC);
}
else//如果已经有了的话 更新
{
var temp= BWeblog_UserCss.GetByBlogUserId(blogContext.BlogUserId);
Weblog_UserCss WUC = new Weblog_UserCss();
WUC.UserCss_Id = temp.First().UserCss_Id;
WUC.UserCss_CssFileId = blogContext.ID;
WUC.UserCss_UserId = blogContext.BlogUserId;
WUC.UserCss_Used = true;
BWeblog_UserCss.Update(WUC);
}
Context.Response.Redirect("/" + blogContext.Owner.User_DomainName);
}
}
}
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:34,代码来源:SelectCss.cs
示例9: CreateChildControls
protected internal override void CreateChildControls()
{
this.Controls.Clear();
this._logInLinkButton = new LinkButton();
this._logInImageButton = new ImageButton();
this._logOutLinkButton = new LinkButton();
this._logOutImageButton = new ImageButton();
this._logInLinkButton.EnableViewState = false;
this._logInImageButton.EnableViewState = false;
this._logOutLinkButton.EnableViewState = false;
this._logOutImageButton.EnableViewState = false;
this._logInLinkButton.EnableTheming = false;
this._logInImageButton.EnableTheming = false;
this._logInLinkButton.CausesValidation = false;
this._logInImageButton.CausesValidation = false;
this._logOutLinkButton.EnableTheming = false;
this._logOutImageButton.EnableTheming = false;
this._logOutLinkButton.CausesValidation = false;
this._logOutImageButton.CausesValidation = false;
CommandEventHandler handler = new CommandEventHandler(this.LogoutClicked);
this._logOutLinkButton.Command += handler;
this._logOutImageButton.Command += handler;
handler = new CommandEventHandler(this.LoginClicked);
this._logInLinkButton.Command += handler;
this._logInImageButton.Command += handler;
this.Controls.Add(this._logOutLinkButton);
this.Controls.Add(this._logOutImageButton);
this.Controls.Add(this._logInLinkButton);
this.Controls.Add(this._logInImageButton);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:LoginStatus.cs
示例10: CreateMainPaginatorControls
protected override Control[] CreateMainPaginatorControls(int fromPage, int toPage)
{
LinkButton[] linkArray = new LinkButton[toPage - fromPage];
for (int i = 0; i < linkArray.Length; i++)
{
linkArray[i] = new LinkButton();
linkArray[i].EnableViewState = false;
if (base.PageButtonTextFormat == null)
{
linkArray[i].Text = ((i + fromPage) + 1).ToString();
}
else
{
linkArray[i].Text = string.Format(base.PageButtonTextFormat, (i + fromPage) + 1);
}
linkArray[i].ID = (i + fromPage).ToString();
if ((i + fromPage) != base.PageIndex)
{
linkArray[i].Attributes.Add("onClick", string.Format("reloadRepeater({0});", i + fromPage));
}
else
{
linkArray[i].CssClass = "current";
}
}
return linkArray;
}
开发者ID:vinasourcetutran,项目名称:searchengine,代码行数:27,代码来源:CustomLinkButtonPager.cs
示例11: AttachChildControls
protected override void AttachChildControls()
{
this.favorites = (Common_Favorite_ProductList) this.FindControl("list_Common_Favorite_ProList");
this.btnSearch = ButtonManager.Create(this.FindControl("btnSearch"));
this.txtKeyWord = (TextBox) this.FindControl("txtKeyWord");
this.pager = (Pager) this.FindControl("pager");
this.btnDeleteSelect = (LinkButton) this.FindControl("btnDeleteSelect");
this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
this.favorites.ItemCommand += new Common_Favorite_ProductList.CommandEventHandler(this.favorites_ItemCommand);
this.btnDeleteSelect.Click += new EventHandler(this.btnDeleteSelect_Click);
PageTitle.AddSiteNameTitle("商品收藏夹", HiContext.Current.Context);
if (!this.Page.IsPostBack)
{
if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ProductId"]))
{
int result = 0;
int.TryParse(this.Page.Request.QueryString["ProductId"], out result);
if (!CommentsHelper.ExistsProduct(result) && !CommentsHelper.AddProductToFavorite(result))
{
this.ShowMessage("添加商品到收藏夹失败", false);
}
}
this.BindList();
}
}
开发者ID:davinx,项目名称:himedi,代码行数:25,代码来源:Favorites.cs
示例12: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (Size != "16" & Size != "24" & Size != "32") Size = "32";
//NOTE: We need to recreate dynamically created controls on postback for them to pickup the event.
var enabledlanguages = LocaleController.Instance.GetLocales(PortalId);
Controls.Add(new LiteralControl("<ul class='editlanguage'>"));
foreach (var l in enabledlanguages)
{
Controls.Add(new LiteralControl("<li>"));
var cmd = new LinkButton();
cmd.Text = "<img src='" + StoreSettings.NBrightBuyPath() + "/Themes/config/img/flags/" + Size + "/" + l.Value.Code + ".png' alt='" + l.Value.EnglishName + "' />";
cmd.CommandArgument = l.Value.Code;
cmd.CommandName = "selectlang";
cmd.Command += (s, cmde) =>
{
var param = new string[2];
if (_entryid != "") param[0] = "eid=" + _entryid;
if (_ctrl != "") param[1] = "ctrl=" + _ctrl;
StoreSettings.Current.EditLanguage = cmde.CommandArgument.ToString();
Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
};
Controls.Add(cmd);
Controls.Add(new LiteralControl("</li>"));
}
Controls.Add(new LiteralControl("</ul>"));
}
开发者ID:Lewy-H,项目名称:NBrightBuy,代码行数:30,代码来源:EditLanguage.ascx.cs
示例13: DisplayButtonStatus
private void DisplayButtonStatus(Boolean isValidStatus, String invalidBallColor,
String validLinkText, String invalidLinkText,
Image linkImage, Label statusLabel = null,
LinkButton linkButton = null,
String onClientClickValidText = null, String onClientClickInvalidText = null)
{
if (isValidStatus)
{
linkImage.ImageUrl = "~/images/green-ball.gif";
if (linkButton != null)
{
linkButton.Text = validLinkText;
if (onClientClickValidText != null)
linkButton.OnClientClick = "return confirm('" + onClientClickValidText + "');";
}
if (statusLabel != null)
statusLabel.Text = validLinkText;
}
else
{
linkImage.ImageUrl = "~/images/" + invalidBallColor + "-ball.gif";
if (linkButton != null)
{
linkButton.Text = invalidLinkText;
if (onClientClickInvalidText != null)
linkButton.OnClientClick = "return confirm('" + onClientClickInvalidText + "');";
}
if (statusLabel != null)
statusLabel.Text = invalidLinkText;
}
}
开发者ID:beachead,项目名称:gooey-cms-v2,代码行数:32,代码来源:default.aspx.cs
示例14: IrGroupListRendering
private void IrGroupListRendering(JObject group)
{
var groupLink = new LinkButton();
var mainDiv = new HtmlGenericControl("div");
var name = new HtmlGenericControl("h5");
var description = new HtmlGenericControl("p");
groupLink.PostBackUrl = Request.Url.AbsolutePath;
groupLink.Attributes.Add("class", "irGroupLink list-item list-item-info");
groupLink.Attributes.Add("irGroupId", group["IrGroupId"].ToString());
mainDiv.Attributes.Add("id", "irGroupMainBlock");
mainDiv.Attributes.Add("class", ".form-inline");
name.Attributes.Add("id", "irGroupName");
name.Attributes.Add("class", "text-primary");
description.Attributes.Add("class", "irGroupDescription");
name.InnerText = group["Name"].ToString();
description.InnerText = group["Description"].ToString();
mainDiv.Controls.Add(name);
mainDiv.Controls.Add(description);
groupLink.Controls.Add(mainDiv);
LinkContainer.Controls.Add(groupLink);
}
开发者ID:Hexxie,项目名称:ecampus.kpi.ua,代码行数:29,代码来源:IrGroupSetView.aspx.cs
示例15: CreateChildControls
protected override void CreateChildControls()
{
Label lbl = new Label();
lbl.ID = "lbl";
this.Controls.Add(lbl);
this.Controls.Add(new LiteralControl("<BR>"));
LinkButton btn = new LinkButton();
btn.ID = "btn";
btn.Text = "复合控件的事件测试";
this.Controls.Add(btn);
//给按钮添加内部事件
btn.Click += new EventHandler(btn_Click);
this.Controls.Add(new LiteralControl("<BR><a id=\"aa\" href=\"javascript:__doPostBack('EventTest1$btn','')\">aa</a>"));
this.Controls.Add(new LiteralControl("<BR><a id=\"a1\" href=\"javascript:__doPostBack('" + this.ClientID + "','1')\">[1]</a>"));
this.Controls.Add(new LiteralControl(" <a id=\"a2\" href=\"javascript:__doPostBack('" + this.ClientID + "','2')\">[2]</a>"));
this.Controls.Add(new LiteralControl(" <a id=\"a3\" href=\"javascript:__doPostBack('" + this.ClientID + "','3')\">[3]</a>"));
this.Controls.Add(new LiteralControl(" <a id=\"a4\" href=\"javascript:__doPostBack('" + this.ClientID + "','4')\">[4]</a>"));
}
开发者ID:endlessido,项目名称:MEDIA,代码行数:32,代码来源:Class1.cs
示例16: InitializeControls
protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
button = new LinkButton { CommandName = CommandName };
button.SetId(ChildId);
if (Click != null) button.Click += Click;
cell.Controls.Add(button);
tooltipbutton = new LinkButton { CommandName = CommandName, Visible = false};
tooltipbutton.SetId(ChildId);
cell.Controls.Add(tooltipbutton);
if (ShowLabelIfDisabled)
{
labelIfDisabled = new Label { Visible = false };
cell.Controls.Add(labelIfDisabled);
tooltiplabelIfDisabled = new Label { Visible = false };
cell.Controls.Add(tooltiplabelIfDisabled);
}
}
开发者ID:NLADP,项目名称:ADF,代码行数:25,代码来源:TextButton.cs
示例17: BuildAlphaIndex
private void BuildAlphaIndex()
{
string[] alphabet = new string[] { "A", "B", "C", "D", "E", "F", "G", "H",
"I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
TableRow row = new TableRow();
TableCell cell = null;
LinkButton lkbtn = null;
for (int i = 0; i < alphabet.Length - 1; i++)
{
cell = new TableCell();
lkbtn = new LinkButton();
lkbtn.Text = alphabet[i].ToString();
lkbtn.Font.Underline = true;
lkbtn.Font.Size = 15;
lkbtn.PostBackUrl = string.Format("IndexView.aspx?Page={0}", alphabet[i].ToString());
cell.Controls.Add(lkbtn);
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = string.Empty;
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = string.Empty;
row.Cells.Add(cell);
}
tblAZ.Rows.Add(row);
}
开发者ID:KevinTheMix,项目名称:CSharp-Wiki,代码行数:29,代码来源:IndexView.aspx.cs
示例18: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
_macroSelectDropdown = new DropDownList();
_macroSelectDropdown.ID = ID + "_ddselectmacro";
_macroSelectDropdown.SelectedIndexChanged += new EventHandler(_macroSelectDropdown_SelectedIndexChanged);
_macroSelectDropdown.Items.Add(new ListItem(umbraco.ui.Text("choose"), ""));
foreach (string item in _allowedMacros)
{
_macroSelectDropdown.Items.Add(new ListItem(GetMacroNameFromAlias(item), item));
}
_macroSelectDropdown.AutoPostBack = true;
_delete = new LinkButton();
_delete.CssClass = "macroDelete";
_delete.ID = ID + "_btndelete";
_delete.Text = ui.Text("removeMacro");
_delete.Attributes.Add("style", "color:red;");
_delete.Click += new EventHandler(_delete_Click);
_formTable = new Table();
_formTable.ID = ID + "_tblform";
_formTable.CssClass = "macroSettings";
propertiesHeader.Visible = false;
this.Controls.Add(_delete);
this.Controls.Add(_macroSelectDropdown);
this.Controls.Add(propertiesHeader);
this.Controls.Add(_formTable);
}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:30,代码来源:MacroEditor.cs
示例19: RegisterButton
public OrderByService RegisterButton(LinkButton button, OrderBy orderBy)
{
button.Click += delegate { ButtonClicked(orderBy); };
SetCssClass(button, orderBy);
Changed += delegate { SetCssClass(button, orderBy); };
return this;
}
开发者ID:teamaton,项目名称:speak-lib,代码行数:7,代码来源:OrderByService.cs
示例20: set
public void set(GridView gd)
{
for (int i = 0; i < gd.Rows.Count; i++)
{
TableCell cell = new TableCell();
LinkButton link = new LinkButton();
link.ID = gd.ID+";"+gd.Rows[i].Cells[0].Text + "change";
link.Text = "编辑";
link.Click += new EventHandler(Button2_Click);
Label lb = new Label();
lb.Text = " ";
LinkButton link2 = new LinkButton();
link2.Text = "删除";
link2.ID = gd.ID+";"+gd.Rows[i].Cells[0].Text + "del";
link2.Click += new EventHandler(Button3_Click);
cell.Controls.Add(link);
cell.Controls.Add(lb);
cell.Controls.Add(link2);
gd.Rows[i].Cells.Add(cell);
}
}
开发者ID:ZhanNeo,项目名称:test,代码行数:25,代码来源:shangpin.aspx.cs
注:本文中的System.Web.UI.WebControls.LinkButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论