protected override void AttachChildControls() { this.favorites = (Common_Favorite_ProductList)this.FindControl("list_Common_Favorite_ProList"); this.btnSearch = ButtonManager.Create(this.FindControl("btnSearch")); this.txtKeyWord = (System.Web.UI.WebControls.TextBox) this.FindControl("txtKeyWord"); this.pager = (Pager)this.FindControl("pager"); this.btnDeleteSelect = (System.Web.UI.WebControls.LinkButton) this.FindControl("btnDeleteSelect"); this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); this.favorites.ItemCommand += new Common_Favorite_ProductList.CommandEventHandler(this.favorites_ItemCommand); this.btnDeleteSelect.Click += new System.EventHandler(this.btnDeleteSelect_Click); PageTitle.AddSiteNameTitle("商品收藏夹", HiContext.Current.Context); if (!this.Page.IsPostBack) { if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ProductId"])) { int productId = 0; int.TryParse(this.Page.Request.QueryString["ProductId"], out productId); if (!CommentsHelper.ExistsProduct(productId) && !CommentsHelper.AddProductToFavorite(productId)) { this.ShowMessage("添加商品到收藏夹失败", false); } } this.BindList(); } }
//Disable submit asp:LinkButton to avoid double post back public static void LinkButtonClickEventGovenor(System.Web.UI.WebControls.LinkButton btn, bool PageHasValidators = false) { string strJavaScript = null; PostBackOptions oPostBackOptions = new PostBackOptions(btn); oPostBackOptions.ActionUrl = btn.PostBackUrl; if (PageHasValidators) { strJavaScript = "if (typeof(Page_ClientValidate) == 'function')"; strJavaScript += "{"; strJavaScript += " if (Page_ClientValidate()) "; strJavaScript += "{"; strJavaScript += " this.value='Please wait...';"; strJavaScript += " this.disabled = true; "; strJavaScript += btn.Page.ClientScript.GetPostBackEventReference(oPostBackOptions) + ";"; strJavaScript += " return false;"; strJavaScript += "}"; strJavaScript += "}"; } else { strJavaScript += " this.value='Please wait...';"; strJavaScript += " this.disabled = true; "; strJavaScript += btn.Page.ClientScript.GetPostBackEventReference(oPostBackOptions) + ";"; } btn.Attributes.Add("OnClick", strJavaScript); }
public void prikaziStranicu(LinkButton linkButtonNaslov) { if (trenutnaStranica > brojStranica) { trenutnaStranica = 1; } string stranica_HTML_ID = ID + "_stranica_" + trenutnaStranica; // gereriramo HTML ID //stranice.ElementAt(trenutnaStranica-1).Id if (brojStranica > 0) { stranicaSemafora stranica = new stranicaSemafora(stranica_HTML_ID, semafor_DB_ID, stranice.ElementAt(trenutnaStranica - 1).Id, stranice.ElementAt(trenutnaStranica - 1).refreshPeriod); Controls.Clear(); //dodajNaslovSemafora(linkButtonNaslov); //dohvatiNaslovSemafora(linkButtonNaslov); Controls.Add(stranica); linkButtonNaslov.Text = nazivSemafora + " - " + stranice.ElementAt(trenutnaStranica - 1).naziv; ++trenutnaStranica; HttpContext.Current.Session["trenutnaStranica"] = trenutnaStranica; } else { HttpContext.Current.Session["trenutnaStranica"] = 1; } //trenutnaStranica++; }
/// <summary> /// Adds icons to the configuration area of a block instance. Can be overridden to /// add additionsl icons /// </summary> /// <param name="canConfig"></param> /// <param name="canEdit"></param> /// <returns></returns> public override List<Control> GetAdministrateControls( bool canConfig, bool canEdit ) { List<Control> configControls = new List<Control>(); // add edit icon to config controls if user has edit permission if ( canConfig || canEdit ) { LinkButton lbEdit = new LinkButton(); lbEdit.CssClass = "edit"; lbEdit.ToolTip = "Edit HTML"; lbEdit.Click += lbEdit_Click; configControls.Add( lbEdit ); HtmlGenericControl iEdit = new HtmlGenericControl( "i" ); lbEdit.Controls.Add( iEdit ); lbEdit.CausesValidation = false; iEdit.Attributes.Add( "class", "fa fa-pencil-square-o" ); // will toggle the block config so they are no longer showing lbEdit.Attributes["onclick"] = "Rock.admin.pageAdmin.showBlockConfig()"; ScriptManager.GetCurrent( this.Page ).RegisterAsyncPostBackControl( lbEdit ); } configControls.AddRange( base.GetAdministrateControls( canConfig, canEdit ) ); return configControls; }
protected void Accordion1_ItemDataBound(object sender, AjaxControlToolkit.AccordionItemEventArgs e) { if (e.ItemType == AjaxControlToolkit.AccordionItemType.Content) { HiddenField hdfid = (HiddenField)e.AccordionItem.FindControl("hdfCodigo"); HiddenField hdfsillas = (HiddenField)e.AccordionItem.FindControl("hdfsillas"); Panel pnlInside = (Panel)e.AccordionItem.FindControl("PnlInside"); //'se crea un ciclo for que añade un texto por cada fila en el dataset for (int i = 0; i < Convert.ToInt32(hdfsillas.Value); i++) { LinkButton lkButon = new LinkButton(); Literal ltl = new Literal(); lkButon.ID = "lkButon" + i.ToString(); lkButon.CssClass = "icon-retweet"; lkButon.Text = "Silla" + (i + 1).ToString(); lkButon.CommandArgument = hdfid.Value + ":" + (i + 1).ToString(); lkButon.Click += new EventHandler(lkButon_Click); pnlInside.Controls.Add(lkButon); ltl.Text = "<br />"; pnlInside.Controls.Add(ltl); } } }
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); } }
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); } }
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); } }
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); }
private void ButtonGenerator() { this.Controls.Clear(); aPage.Clear(); foreach (var item in Items) { var lb = new System.Web.UI.WebControls.LinkButton(); lb.ID = this.ID + "_pages_" + item.Iteration; lb.Command += lbPage_Command; lb.CommandArgument = item.Iteration.ToString(); lb.Text = item.Iteration.ToString(); lb.CssClass = (item.Active) ? "active" : ""; lb.EnableViewState = false; aPage.Add(lb); this.Controls.Add(lb); } aPrev.Click += OnPrevHandler; aPrev.Text = "Poprzednie"; aPrev.ID = this.ID + "_prev_btn"; aNext.Click += OnNextHandler; aNext.Text = "Następne"; aNext.ID = this.ID + "_next_btn"; this.Controls.Add(aPrev); this.Controls.Add(aNext); }
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); }
private void SetSortHeaderAttributes(ASP.GridViewRowEventArgs e) { bool images = (this.AscImage != String.Empty && this.DescImage != String.Empty); for (int i = 0; i < e.Row.Cells.Count; i++) { ASP.TableCell td = e.Row.Cells[i]; if (td.HasControls()) { ASP.LinkButton button = td.Controls[0] as ASP.LinkButton; if (button != null) { if (this.SortExpression == button.CommandArgument) { td.ApplyStyle(this.SortedColumnHeaderRowStyle); this.sortColumnIndex = i; if (images) { ImageButton btn = new ImageButton(); btn.CommandName = button.CommandName; btn.CommandArgument = button.CommandArgument; btn.ImageUrl = (this.SortDirection == ASP.SortDirection.Ascending ? this.AscImage : this.DescImage); td.Controls.Add(new LiteralControl(" ")); td.Controls.Add(btn); td.Controls.Add(new LiteralControl(" ")); } } } } } }
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); } } }
private void AddPager(System.Web.UI.Control parentControl, int pageIndex = -1, string commandArgument = null, string text = null) { HtmlGenericControl li = new HtmlGenericControl("li"); if (pageIndex == PageIndex) { li.Attributes.Add("class", "active"); } System.Web.UI.WebControls.LinkButton button = new System.Web.UI.WebControls.LinkButton(); button.CommandName = "Page"; if (text == null) { button.Text = (pageIndex + 1).ToString(); } else { button.Text = text; } if (string.IsNullOrWhiteSpace(commandArgument)) { button.CommandArgument = string.Format("{0}", pageIndex); } else { button.CommandArgument = commandArgument; } button.Click += navigate_Click; li.Controls.Add(button); parentControl.Controls.Add(li); }
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; }
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>")); }
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); } }
protected void docGrid_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { System.Web.UI.WebControls.LinkButton btnTplImg = (System.Web.UI.WebControls.LinkButton)e.Item.Cells[0].FindControl("btnImgTemplate"); string docFile = e.Item.Cells[0].Text; if (docFile == " " || string.IsNullOrEmpty(docFile)) { btnTplImg.Text = "<div class=\"hd-sp-img hd-sp-img-blank\" ></div>"; return; } switch (Path.GetExtension(docFile).ToLower()) { case ".pdf": case ".hpd": case ".hfd": // form template btnTplImg.Text = "<div class=\"hd-sp-img hd-sp-img-frm\" ></div>"; break; default: // text template btnTplImg.Text = "<div class=\"hd-sp-img hd-sp-img-txt\" ></div>"; break; } } }
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; } }
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); }
protected override void CreateChildControls() { lnkExpand = new HyperLink(); lnkExpand.ID = "lnkExpand" + this.ClientID; lnkExpand.Text = "Expand All" + " / "; lnkExpand.NavigateUrl = "#"; lnkCollapse = new HyperLink(); lnkCollapse.ID = "lnkCollapse" + this.ClientID; lnkCollapse.Text = "Collapse All"; lnkCollapse.NavigateUrl = "#"; lnkDocket = new LinkButton(); lnkDocket.ID = "lnkDocketSearch" + this.ClientID; lnkDocket.Text = "Change Docket" + " / "; lnkDocket.OnClientClick = docketClick; lnkDocket.Visible = IsDocketRequired; if (string.IsNullOrEmpty(ExpandCSS)) { ExpandCSS = "divExpand"; } Controls.Add(new LiteralControl("<table style='float: right;'> <tr> <td class='"+ExpandCSS+"'>")); Controls.Add(lnkDocket); Controls.Add(lnkExpand); Controls.Add(lnkCollapse); Controls.Add(new LiteralControl(" </td> </tr> </table>")); Controls.Add(new LiteralControl(" <br />")); Controls.Add(new LiteralControl("<div style='padding-top:5px;'>")); Controls.Add(new LiteralControl("</div>")); }
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(); } }
// ********************************************************************* // CreateNumericalNavigation // /// <summary> /// Creates numerical navigation link buttons /// </summary> /// <returns></returns> // ********************************************************************/ private Control CreateNumericalNavigation() { numericalPaging = new PlaceHolder(); int linkButtonsToCreate; if (TotalPages > numericalLinkButtons.Length) { linkButtonsToCreate = numericalLinkButtons.Length; } else { linkButtonsToCreate = TotalPages; } // Create all the link buttons for (int i = 0; i < linkButtonsToCreate; i++) { numericalLinkButtons[i] = new System.Web.UI.WebControls.LinkButton(); numericalLinkButtons[i].CssClass = "normalTextSmallBold"; numericalLinkButtons[i].Click += new EventHandler(PageIndex_Click); numericalLinkButtons[i].Text = (i + 1).ToString("n0"); numericalLinkButtons[i].CommandArgument = i.ToString(); numericalPaging.Controls.Add(numericalLinkButtons[i]); } return(numericalPaging); }
public void InstantiateIn(Control objContainer) { LinkButton lnkbtn = new LinkButton(); lnkbtn.CommandName = strCommandName; lnkbtn.DataBinding += new EventHandler(lnkbtn_DataBinding); objContainer.Controls.Add(lnkbtn); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { System.Web.UI.WebControls.Label id = (System.Web.UI.WebControls.Label)e.Row.FindControl("Label1"); System.Web.UI.WebControls.LinkButton lbtn = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("lnkView"); if (e.Row.RowType == DataControlRowType.DataRow) { if (id.Text != "") { if (Session["roles"].ToString() == "R0001") { if (id.Text == "R0001") { lbtn.Attributes.Remove("Style"); } //else //{ // lbtn.Attributes.Remove("Style"); //} } else { if (id.Text == "R0001") { lbtn.Attributes.Add("Style", "pointer-events:None;"); } } } } }
public void InstantiateIn(System.Web.UI.Control container) { switch (itemType) { case ListItemType.Footer: if(options.Contains(UserAction.Insert)){ LinkButton insButton = new LinkButton(); insButton.Text = "Insert new item"; insButton.CommandName = "_Insert"; container.Controls.Add(insButton); } break; case ListItemType.Item: if (options.Contains(UserAction.View)) { LinkButton viewButton = new LinkButton(); viewButton.Text = "Edit"; viewButton.CommandName = "_View"; container.Controls.Add(viewButton); } if (options.Contains(UserAction.Delete)) { LinkButton delButton = new LinkButton(); delButton.Text = "Delete"; delButton.CommandName = "_Delete"; delButton.OnClientClick = "return confirm('Really?')"; container.Controls.Add(delButton); } break; default: break; } }
public OrderByService RegisterButton(LinkButton button, OrderBy orderBy) { button.Click += delegate { ButtonClicked(orderBy); }; SetCssClass(button, orderBy); Changed += delegate { SetCssClass(button, orderBy); }; return this; }
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); } } } } }
void ITemplate.InstantiateIn(Control container) { switch (TemplateType) { case ListItemType.Header: var lb2 = new LinkButton { Text = ColumnName }; lb2.CommandName = "Sort"; if (ColumnName != string.Empty) { lb2.CommandArgument = HeadingTranslator.TranslateHeader(ColumnName); } container.Controls.Add(lb2); break; case ListItemType.Item: if (ColumnName == EditColumnName) { var lb = new System.Web.UI.WebControls.LinkButton(); lb.DataBinding += LinkButton_DataBinding; container.Controls.Add(lb); } else { var lbl2 = new Label(); lbl2.DataBinding += LinkButton_DataBinding; container.Controls.Add(lbl2); } break; } }
/// <summary> /// Populates the directory breadcrumb placeholder. See also methods linkButton_Click e lnkRoot_Click. /// </summary> private void PopulateBreadcrumb() { plhDirectory.Controls.Clear(); // Get all directories by splitting the content of txtCurrentDirectory string[] dirs = CurrentDirectory.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); // Add a LinkButton and a "/" label for each directory string current = "/"; for (int i = 0; i < dirs.Length; i++) { System.Web.UI.WebControls.LinkButton lnk = new System.Web.UI.WebControls.LinkButton(); lnk.ID = "lnkDir" + i.ToString(); lnk.Text = dirs[i]; current += dirs[i] + "/"; lnk.CommandArgument = current; lnk.ToolTip = current; lnk.Click += new EventHandler(linkButton_Click); plhDirectory.Controls.Add(lnk); System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label(); lbl.ID = "lblDir" + i.ToString(); lbl.Text = " / "; plhDirectory.Controls.Add(lbl); } }
private void SetActiveLinkButton(LinkButton lbActive) { lnkCategory1.CssClass = "SideMenuLink"; lnkCategory2.CssClass = "SideMenuLink"; lnkCategory3.CssClass = "SideMenuLink"; lbActive.CssClass = "SideMenuLink active"; }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Set the hand mouse cursor for the selected row. e.Row.Attributes.Add("OnMouseOver", "this.style.cursor = 'hand'; this.style.background = '#003366';"); e.Row.Attributes.Add("OnMouseOut", "this.style.background = '#F9F6F4';"); // The seelctButton exists for ensuring the selection functionality // and bind it with the appropriate event hanlder. LinkButton selectButton = new LinkButton() { CommandName = "Select", Text = e.Row.Cells[0].Text }; selectButton.Font.Underline = false; selectButton.ForeColor = System.Drawing.Color.Black; e.Row.Cells[0].Controls.Add(selectButton); //e.Row.Attributes["OnClick"] = // Page.ClientScript.GetPostBackClientHyperlink(selectButton, ""); e.Row.Attributes["OnClick"] = Page.ClientScript.GetPostBackClientHyperlink((Control)sender, "Select$" + e.Row.RowIndex); } }
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //Label lbl=new Label(); System.Web.UI.WebControls.Label lbl = (Label)e.Item.Cells[11].FindControl("lblComp"); System.Web.UI.WebControls.LinkButton lk = (LinkButton)e.Item.Cells[11].FindControl("Linkbutton2"); if (DataBinder.Eval(e.Item.DataItem, "WO_DATA") != System.DBNull.Value) { lbl.Visible = true; lk.Visible = false; } else { completare = true; //LinkButton lk = new LinkButton(); lk.CommandArgument = DataBinder.Eval(e.Item.DataItem, "wo_id").ToString(); lk.Text = "Completa"; lk.CommandName = "lkin"; //lk.Command +=new CommandEventHandler(this.pluto); lbl.Visible = false; lk.Visible = true; //lk.Click +=new EventHandler(lk_Click); //CommandEventArgs cma = new CommandEventArgs(lk.CommandName, lk.CommandArgument); //xx2+=new xx(lk_Command); //e.Item.Cells[11].Controls.Add(lk); //xx2(lk, cma); } } }
public void CaseCareLevelSeveritySaveLink_OnClick(Object sender, EventArgs e) { // GET REFERENCE TO CURRENT LINK BUTTON WEB CONTROL SAVE LINK FROM SENDER OBJECT System.Web.UI.WebControls.LinkButton currentSaveLink = (System.Web.UI.WebControls.LinkButton)sender; // GET REFERENCE TO CURRENT WEB CONTROL FROM PARENT OF CURRENT SAVE LINK LINK BUTTON WEB CONTROL System.Web.UI.Control currentWebControl = (System.Web.UI.Control)currentSaveLink.Parent; // GET REFERENCE TO CURRENT CASE CARE LEVEL SEVERITY CHANGE SELECTION RAD COMBO BOX Telerik.Web.UI.RadComboBox currentCaseCareLevelSeverityChangeSelection = (Telerik.Web.UI.RadComboBox)currentWebControl.FindControl("CaseCareLevelSeveritySelection"); // CREATE REFERENCE TO PARSED SELECTED CARE LEVEL ID Int64 parsedselectedCareLevelId; // TRY TO PARSE SELECTED VALUE OF CURRENT CASE CARE LEVEL SEVERITY CHANGE SELECTION RAD COMBO BOX AS INT 64 if (Int64.TryParse(currentCaseCareLevelSeverityChangeSelection.SelectedValue, out parsedselectedCareLevelId)) { // SET SELECTED CARE LEVEL ID AS INT 64 OF SELECTED VALUE OF CURRENT CASE CARE LEVEL SEVERITY CHANGE SELECTION RAD COMBO BOX Int64 selectedCareLevelId = Convert.ToInt64(currentCaseCareLevelSeverityChangeSelection.SelectedValue); } // SET MEMBER CASE CARE PLAN SEVERITY LEVEL /* TODO: DAVID: SEVERITY (CARE LEVEL) IS NOT YET A PROPERTY OF MEMEBR CASE CARE PLAN IN CODE OR DATABASE */ return; }
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); } }
protected void OnDataBind(object sender, RepeaterItemEventArgs args) { if (args.Item.ItemType != ListItemType.Item && args.Item.ItemType != ListItemType.AlternatingItem) { return; } System.Web.UI.WebControls.Label lRoleType = (System.Web.UI.WebControls.Label)args.Item.FindControl("lRoleType"); System.Web.UI.WebControls.Label lRole = (System.Web.UI.WebControls.Label)args.Item.FindControl("lRole"); HtmlTableCell tdRoleType = (HtmlTableCell)args.Item.FindControl("tdRoleType"); System.Web.UI.WebControls.LinkButton lnkDelete = (System.Web.UI.WebControls.LinkButton)args.Item.FindControl("lnkDelete"); if (!ShowRoleType) { tdRoleType.Visible = false; } else { if (args.Item.DataItem as EditRole != null) { lRoleType.Text = Portal.API.Language.GetText(Portal.API.Module.GetModuleControl(this), "RoleEdit"); } else { lRoleType.Text = Portal.API.Language.GetText(Portal.API.Module.GetModuleControl(this), "RoleView"); } } lnkDelete.CommandArgument = args.Item.ItemIndex.ToString(); lRole.Text = ((Role)args.Item.DataItem).name; }
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>")); }
protected void Page_Load(object sender, EventArgs e) { SqlDataSource sds = DatabaseManager.CreateSQLDataSource("SELECT INS_REQ_ID รหัส,PS_CITIZEN_ID รหัสบัตรประชาชน,INS_GRADEINSIGNIA_ID ลำดับเครื่องราช,REQ_DATE วันที่ขอ,STATE สถานะการขอ FROM INSG_REQUEST "); GridView1.DataSource = sds; GridView1.DataBind(); Util.NormalizeGridViewDate(GridView1, 3); TableHeaderCell newHeader = new TableHeaderCell(); newHeader.Text = "เลือก"; GridView1.HeaderRow.Cells.Add(newHeader); for (int i = 0; i < GridView1.Rows.Count; ++i) { string id = GridView1.Rows[i].Cells[0].Text; Form1Package f1 = DatabaseManager.GetForm1Package(id); LinkButton lbu = new LinkButton(); lbu.Text = "เลือก"; lbu.CssClass = "ps-button"; lbu.Click += (e2, e3) => { MultiView1.ActiveViewIndex = 1; }; TableCell cell = new TableCell(); cell.Controls.Add(lbu); GridView1.Rows[i].Cells.Add(cell); } }
protected void Grv_SPLBMB_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.FindControl("lkbut_del").ToString() == "System.Web.UI.WebControls.LinkButton") { System.Web.UI.WebControls.LinkButton lbtn = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("lkbut_del"); lbtn.Attributes.Add("onclick", "return confirm('您确定删除吗?')"); } } string aa = e.Row.RowState.ToString(); if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState == DataControlRowState.Edit || (aa == "Alternate, Edit")) { DropDownList cblSXZ = (DropDownList)e.Row.FindControl("cblSXZ"); HtmlInputHidden ipt_CtrlDisplayType = (HtmlInputHidden)e.Row.FindControl("ipt_CtrlDisplayType"); if (ipt_CtrlDisplayType.Value != "") { cblSXZ.SelectedValue = ipt_CtrlDisplayType.Value; } //所属组 DropDownList cblSSZ = (DropDownList)e.Row.FindControl("cblSSZ"); HtmlInputHidden ipt_CtrlDisplaySSZ = (HtmlInputHidden)e.Row.FindControl("ipt_CtrlDisplaySSZ"); if (ipt_CtrlDisplaySSZ.Value != "") { cblSSZ.SelectedValue = ipt_CtrlDisplaySSZ.Value; } } }
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); } } }
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); }
private void DGrdMail_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if (e.Item.ItemIndex == -1) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)e.Item.FindControl("cbSelAll"); if (checkBox != null) { checkBox.Attributes.Add("onclick", "selectAll(this);"); return; } } else { DataRowView dataRowView = (DataRowView)e.Item.DataItem; e.Item.Attributes["onclick"] = "OnRecord(this);"; string a = dataRowView["c_fj"].ToString(); string a2 = dataRowView["c_xbs"].ToString(); if (a == "n") { System.Web.UI.WebControls.Image image = (System.Web.UI.WebControls.Image)e.Item.Cells[5].Controls[1]; image.Visible = false; } if (a2 == "n") { System.Web.UI.WebControls.Image image2 = (System.Web.UI.WebControls.Image)e.Item.Cells[1].Controls[1]; image2.Visible = false; System.Web.UI.WebControls.LinkButton linkButton = (System.Web.UI.WebControls.LinkButton)e.Item.Cells[3].Controls[1]; linkButton.Style.Add("color", "#333333"); return; } e.Item.Attributes.Add("style", "font-weight:bolder;"); System.Web.UI.WebControls.LinkButton linkButton2 = (System.Web.UI.WebControls.LinkButton)e.Item.Cells[3].Controls[1]; linkButton2.Style.Add("color", "#333333"); } }
/// <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); }
protected override void CreateChildControls() { LinkButton lb = new LinkButton(); lb.Text = "DownLoad"; lb.OnClientClick = "CheckFiles();return false;"; lb.CssClass = "ms-menubuttoninactivehover"; this.Controls.Add(lb); }
public static IButton CreateLinkButton(LinkButton button) { if (button == null) { throw new ArgumentNullException("button", "The button parameter can not be null"); } return new LinkButtonWrapper(button); }
protected void Page_Load(object sender, EventArgs e) { System.Web.UI.HtmlControls.HtmlTableRow r1; System.Web.UI.HtmlControls.HtmlTableCell c1; System.Web.UI.HtmlControls.HtmlTableCell c2; System.Web.UI.HtmlControls.HtmlTableCell c3; System.Web.UI.HtmlControls.HtmlTableCell c4; System.Web.UI.HtmlControls.HtmlImage img; System.Web.UI.HtmlControls.HtmlGenericControl name; System.Web.UI.HtmlControls.HtmlInputText quant; System.Web.UI.HtmlControls.HtmlGenericControl subtot; System.Web.UI.WebControls.LinkButton rmvBtn; System.Web.UI.HtmlControls.HtmlGenericControl glyph; for (int i = 0; i < 5; i++) { r1 = new System.Web.UI.HtmlControls.HtmlTableRow(); c1 = new System.Web.UI.HtmlControls.HtmlTableCell(); c2 = new System.Web.UI.HtmlControls.HtmlTableCell(); c3 = new System.Web.UI.HtmlControls.HtmlTableCell(); c4 = new System.Web.UI.HtmlControls.HtmlTableCell(); img = new System.Web.UI.HtmlControls.HtmlImage(); name = new System.Web.UI.HtmlControls.HtmlGenericControl(); quant = new System.Web.UI.HtmlControls.HtmlInputText(); subtot = new System.Web.UI.HtmlControls.HtmlGenericControl(); rmvBtn = new System.Web.UI.WebControls.LinkButton(); glyph = new System.Web.UI.HtmlControls.HtmlGenericControl(); r1.Controls.Add(c1); r1.Controls.Add(c2); r1.Controls.Add(c3); r1.Controls.Add(c4); img.Src = "http://placehold.it/50"; name.InnerText = " Item name"; c1.Controls.Add(img); c1.Controls.Add(name); quant.Style["width"] = "5em"; c2.Controls.Add(quant); subtot.InnerText = "$10.00"; c3.Controls.Add(subtot); rmvBtn.CssClass = "btn btn-danger"; rmvBtn.PostBackUrl = "?delete=id"; glyph.Attributes.Add("aria-hidden", "true"); glyph.Attributes.Add("class", "glyphicon glyphicon-remove"); rmvBtn.Controls.Add(glyph); c4.Controls.Add(rmvBtn); cartDisplay.Controls.Add(r1); } }
// --------------------- BasePage.ReturnLinkClickHandler ------------------ // return to referrer page link click handler. public void ReturnLinkClickHandler(System.Web.UI.WebControls.LinkButton InLink) { if (InLink.Visible == true) { LoadMaster lm = PageReferrerLoadMaster; if (lm != null) { Response.Redirect(lm.RawUrl); } } }
private System.Web.UI.WebControls.LinkButton GetLinkButton(string name, System.Web.UI.WebControls.RepeaterItem ri) { System.Web.UI.WebControls.LinkButton obj = null; try { obj = (System.Web.UI.WebControls.LinkButton)ri.FindControl(name); } catch { } return(obj); }
protected void dgNavSub_ItemDataBound(object sender, DataGridItemEventArgs e) { System.Web.UI.WebControls.LinkButton NavSubLink = (LinkButton)e.Item.Cells[0].FindControl("NavSubLink"); if (NavSubLink != null) { // Add javascript to direct each item to the correct page NavSubLink.Text = e.Item.Cells[1].Text; NavSubLink.CommandArgument = e.Item.Cells[2].Text; //NavSubLink.Attributes.Add("onclick", "javascript:GetUser('" + e.Item.Cells[2].Text + "');"); NavSubLink.Command += new CommandEventHandler(NavSubLink_Command); } }
protected void OfferHistoryGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.LinkButton lbNewWindow = new System.Web.UI.WebControls.LinkButton(); lbNewWindow = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("btnDetails"); if (lbNewWindow != null) { string offerId = DataBinder.Eval(e.Row.DataItem, "IDOferty").ToString(); lbNewWindow.Attributes.Add("offerId", offerId); } } }
// ----------------------- BasePage.ReturnLinkSetup -------------------- // enable and setup the text of the return to referrer link. public void ReturnLinkSetup(System.Web.UI.WebControls.LinkButton InLink) { LoadMaster lm = PageReferrerLoadMaster; if (lm == null) { InLink.Visible = false; } else { InLink.Visible = true; InLink.Text = "back to " + lm.PageTitle; } }
private void GetLinkButton(string name, Page p, bool b) { try { System.Web.UI.WebControls.LinkButton obj = (System.Web.UI.WebControls.LinkButton)p.Page.FindControl(name); if (obj != null) { obj.Visible = b; } } catch { } }
protected void OffersGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int?offerId = DataBinder.Eval(e.Row.DataItem, "IDOferty") as int?; e.Row.CssClass = IsOfferReserved(offerId) ? "item-reserved" : ""; System.Web.UI.WebControls.LinkButton lbNewWindow = new System.Web.UI.WebControls.LinkButton(); lbNewWindow = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("DetailsLink"); if (lbNewWindow != null) { lbNewWindow.Attributes.Add("offerId", offerId.ToString()); } } }
protected void GridViewAttractions_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int?attractionId = DataBinder.Eval(e.Row.DataItem, "IDAtrakcjiUslugi") as int?; e.Row.CssClass = IsAttractionReserved(attractionId) ? "item-reserved" : ""; System.Web.UI.WebControls.LinkButton lbNewWindow = new System.Web.UI.WebControls.LinkButton(); lbNewWindow = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("btnShowDetails"); if (lbNewWindow != null) { lbNewWindow.Attributes.Add("attractionId", attractionId.ToString()); } } }
protected void repProblemsA1_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = (DataRowView)e.Item.DataItem; DataRow dr = drv.Row; System.Web.UI.WebControls.LinkButton lnkbtn = (System.Web.UI.WebControls.LinkButton)e.Item.FindControl("lnkbtnA1Problem"); if (!dr.IsNull("problem_id")) { lnkbtn.Attributes.Add("problemid", dr["problem_id"].ToString()); } } }
private void linkButton_Click(object sender, EventArgs e) { System.Web.UI.WebControls.LinkButton lnk = sender as System.Web.UI.WebControls.LinkButton; if (lnk != null) { CurrentDirectory = lnk.CommandArgument; DetectPermissions(); SetupControlsForPermissions(); rptItems.DataBind(); PopulateBreadcrumb(); } }
/// <summary> /// Overrides <see cref="Control.CreateChildControls"/>. /// </summary> protected override void CreateChildControls() { base.CreateChildControls(); button = new System.Web.UI.WebControls.LinkButton(); button.CausesValidation = false; button.ID = "clicker"; button.Click += new EventHandler(this.button_Click); this.Controls.Add(button); tracker = new HtmlInputHidden(); tracker.Name = "tracker"; tracker.ID = "tracker"; tracker.ServerChange += new EventHandler(this.ClientExpanedStateChanged); this.Controls.Add(tracker); }
protected void gvEmp_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.Label sts = (System.Web.UI.WebControls.Label)e.Row.FindControl("Label4"); System.Web.UI.WebControls.LinkButton lnk = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("lnkView2"); if (sts.Text.Trim() == "AKTIF") { lnk.Attributes.Remove("Style"); } else { lnk.Attributes.Add("Style", "pointer-events:None;"); } } }
//protected void RadGrid1_GridExporting(object source, GridExportingArgs e) //{ // switch (e.ExportType) // { // case ExportType.Excel: // do something with the e.ExportOutput value // break; // case ExportType.ExcelML: // do something with the e.ExportOutput value // break; // case ExportType.Word: // do something with the e.ExportOutput value // break; // case ExportType.Csv: // do something with the e.ExportOutput value // break; // case ExportType.Pdf: // you can't change the output here - use the PdfExporting event instead // break; // } //} //open_in_new_tab(url) //protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) //{ // if (e.CommandName == RadGrid.ExportToPdfCommandName) // isPdfExport = true; //} //protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) //{ // if (isPdfExport) // FormatGridItem(e.Item); //} //protected void FormatGridItem(GridItem item) //{ // item.Style["color"] = "#eeeeee"; // if (item is GridDataItem) // { // item.Style["vertical-align"] = "middle"; // item.Style["text-align"] = "center"; // } // switch (item.ItemType) //Mimic RadGrid appearance for the exported PDF file // { // case GridItemType.Item: item.Style["background-color"] = "#4F4F4F"; break; // case GridItemType.AlternatingItem: item.Style["background-color"] = "#494949"; break; // case GridItemType.Header: item.Style["background-color"] = "#2B2B2B"; break; // case GridItemType.CommandItem: item.Style["background-color"] = "#000000"; break; // } // if (item is GridCommandItem) // { // item.PrepareItemStyle(); //needed to span the image over the CommandItem cells // } //} protected void gv_ClientDetails_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.LinkButton lbNewWindow = new System.Web.UI.WebControls.LinkButton(); lbNewWindow = (System.Web.UI.WebControls.LinkButton)e.Row.FindControl("LinkButtonEdit"); if (lbNewWindow != null) { string clientID = DataBinder.Eval(e.Row.DataItem, "ClientID").ToString(); string newURL = Globals.NavigateURL(myTabID, "EditClient", "mid=" + myModID.ToString() + "&cid=" + clientID); lbNewWindow.Attributes.Add("OnClick", "open_in_new_tab('" + newURL.ToString() + "')"); } } }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.DataItem != null) { ProductionPlanMstr m = (ProductionPlanMstr)e.Row.DataItem; var runProductionPlanLogs = TheGenericMgr.FindAllWithCustomQuery <RunProductionPlanLog>("select r from RunProductionPlanLog as r where r.BatchNo=?", m.BatchNo); if (runProductionPlanLogs == null || runProductionPlanLogs.Count == 0) { System.Web.UI.WebControls.LinkButton lbtnShowErrorMsg = e.Row.FindControl("lbtnShowErrorMsg") as System.Web.UI.WebControls.LinkButton; lbtnShowErrorMsg.Visible = false; } if (m.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { System.Web.UI.WebControls.LinkButton lbtSubmit = e.Row.FindControl("lbtSubmit") as System.Web.UI.WebControls.LinkButton; lbtSubmit.Visible = false; } if (m.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT) { string searchSql = "select max(releaseno) from MRP_ProductionPlanMstr where Status='Submit' "; var maxReleaseNos = TheGenericMgr.GetDatasetBySql(searchSql).Tables[0]; int releaseNo = 0; foreach (System.Data.DataRow row in maxReleaseNos.Rows) { releaseNo = Convert.ToInt32(row[0]); } if (releaseNo == m.ReleaseNo) { } else { System.Web.UI.WebControls.LinkButton lbtRunProdPlan = e.Row.FindControl("lbtRunProdPlan") as System.Web.UI.WebControls.LinkButton; lbtRunProdPlan.Visible = false; System.Web.UI.WebControls.LinkButton lbtRunProdPlan2 = e.Row.FindControl("lbtRunProdPlan2") as System.Web.UI.WebControls.LinkButton; lbtRunProdPlan2.Visible = false; } } else { System.Web.UI.WebControls.LinkButton lbtRunProdPlan = e.Row.FindControl("lbtRunProdPlan") as System.Web.UI.WebControls.LinkButton; lbtRunProdPlan.Visible = false; System.Web.UI.WebControls.LinkButton lbtRunProdPlan2 = e.Row.FindControl("lbtRunProdPlan2") as System.Web.UI.WebControls.LinkButton; lbtRunProdPlan2.Visible = false; } } }