Control CreateButton(ButtonColumnType type, string text, string command, bool valid) { Button b; LinkButton d; if (type == ButtonColumnType.LinkButton) { d = new ForeColorLinkButton(); d.Text = text; d.CommandName = command; d.CausesValidation = valid; if (valid) { d.ValidationGroup = ValidationGroup; } return(d); } b = new Button(); b.Text = text; b.CommandName = command; b.CausesValidation = valid; if (valid) { b.ValidationGroup = ValidationGroup; } return(b); }
public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (itemType != ListItemType.Header && itemType != ListItemType.Footer) { switch (ButtonType) { case ButtonColumnType.LinkButton: { LinkButton butt = new ForeColorLinkButton(); butt.Text = Text; butt.CommandName = CommandName; if (DataTextField != "") { butt.DataBinding += new EventHandler(DoDataBind); } cell.Controls.Add(butt); } break; case ButtonColumnType.PushButton: { Button butt = new Button(); butt.Text = Text; butt.CommandName = CommandName; if (DataTextField != "") { butt.DataBinding += new EventHandler(DoDataBind); } cell.Controls.Add(butt); } break; } } }
public virtual void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType) { switch (itemType) { case ListItemType.Header: { /* If sorting is enabled, add a * LinkButton or an ImageButton * (depending on HeaderImageUrl). * * If sorting is disabled, the * HeaderText or an Image is displayed * (depending on HeaderImageUrl). * * If neither HeaderText nor * HeaderImageUrl is set, use */ bool sort = false; string sort_ex = SortExpression; if (owner != null && sort_ex.Length > 0) sort = owner.AllowSorting; string image_url = HeaderImageUrl; if (image_url.Length > 0) { if (sort) { ImageButton butt = new ImageButton (); /* Don't need to * resolve this, Image * does that when it * renders */ butt.ImageUrl = image_url; butt.CommandName = "Sort"; butt.CommandArgument = sort_ex; cell.Controls.Add (butt); } else { Image image = new Image (); image.ImageUrl = image_url; cell.Controls.Add (image); } } else { if (sort) { // This one always gets the forecolor of the header_style // from one of the parents, but we can't look it up at this // point, as it can change afterwards. LinkButton link = new ForeColorLinkButton (); link.Text = HeaderText; link.CommandName = "Sort"; link.CommandArgument = sort_ex; cell.Controls.Add (link); } else { string text = HeaderText; if (text.Length > 0) cell.Text = text; else cell.Text = " "; } } } break; case ListItemType.Footer: { /* Display FooterText or */ string text = FooterText; if (text.Length > 0) cell.Text = text; else cell.Text = " "; } break; default: break; } }
Control CreateButton(ButtonColumnType type, string text, string command, bool valid) { Button b; LinkButton d; if (type == ButtonColumnType.LinkButton) { d = new ForeColorLinkButton(); d.Text = text; d.CommandName = command; d.CausesValidation = valid; #if NET_2_0 if (valid) { d.ValidationGroup = ValidationGroup; } #endif return d; } b = new Button(); b.Text = text; b.CommandName = command; b.CausesValidation = valid; #if NET_2_0 if (valid) { b.ValidationGroup = ValidationGroup; } #endif return b; }
public override void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell (cell, columnIndex, itemType); if (itemType != ListItemType.Header && itemType != ListItemType.Footer) { switch (ButtonType) { case ButtonColumnType.LinkButton: { LinkButton butt = new ForeColorLinkButton (); butt.Text = Text; butt.CommandName = CommandName; if (DataTextField != "") butt.DataBinding += new EventHandler (DoDataBind); cell.Controls.Add (butt); } break; case ButtonColumnType.PushButton: { Button butt = new Button (); butt.Text = Text; butt.CommandName = CommandName; if (DataTextField != "") butt.DataBinding += new EventHandler (DoDataBind); cell.Controls.Add (butt); } break; } } }
public virtual void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { switch (itemType) { case ListItemType.Header: { /* If sorting is enabled, add a * LinkButton or an ImageButton * (depending on HeaderImageUrl). * * If sorting is disabled, the * HeaderText or an Image is displayed * (depending on HeaderImageUrl). * * If neither HeaderText nor * HeaderImageUrl is set, use */ bool sort = false; string sort_ex = SortExpression; if (owner != null && sort_ex.Length > 0) { sort = owner.AllowSorting; } string image_url = HeaderImageUrl; if (image_url.Length > 0) { if (sort) { ImageButton butt = new ImageButton(); /* Don't need to * resolve this, Image * does that when it * renders */ butt.ImageUrl = image_url; butt.CommandName = "Sort"; butt.CommandArgument = sort_ex; cell.Controls.Add(butt); } else { Image image = new Image(); image.ImageUrl = image_url; cell.Controls.Add(image); } } else { if (sort) { // This one always gets the forecolor of the header_style // from one of the parents, but we can't look it up at this // point, as it can change afterwards. LinkButton link = new ForeColorLinkButton(); link.Text = HeaderText; link.CommandName = "Sort"; link.CommandArgument = sort_ex; cell.Controls.Add(link); } else { string text = HeaderText; if (text.Length > 0) { cell.Text = text; } else { cell.Text = " "; } } } } break; case ListItemType.Footer: { /* Display FooterText or */ string text = FooterText; if (text.Length > 0) { cell.Text = text; } else { cell.Text = " "; } } break; default: break; } }