本文整理汇总了C#中System.Web.UI.WebControls.ImageButton类的典型用法代码示例。如果您正苦于以下问题:C# ImageButton类的具体用法?C# ImageButton怎么用?C# ImageButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageButton类属于System.Web.UI.WebControls命名空间,在下文中一共展示了ImageButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createGameField
protected void createGameField(int gridSize)
{
ImageButton tb = new ImageButton();
if (ListOfButtons != null)
ListOfButtons.Clear();
for (int i = 1; i <= gridSize; i++)
{
tb = new ImageButton();
tb.ID = i.ToString();
tb.Width = 40;
tb.Height = 40;
tb.BackColor = System.Drawing.Color.White;
tb.ImageUrl = @"https://upload.wikimedia.org/wikipedia/commons/c/c7/Minesweeper_unopened_square.svg";
tb.Click += new ImageClickEventHandler(this.Button_Click);
gameField.Controls.Add(tb);
ListOfButtons.Add(tb);
}
gameField.Width = (int)(Math.Sqrt(gridSize) * 40);
gameField.Height = gameField.Width;
}
示例2: OnInit
protected override void OnInit(EventArgs e)
{
dataTab = this.TabViewDetails.NewTabPage("Videos");
dataTab.Controls.Add(this.tabVideos);
btnDownloadVideos = dataTab.Menu.NewImageButton();
btnDownloadVideos.ID = "btnDownloadVideos";
btnDownloadVideos.ClientIDMode = System.Web.UI.ClientIDMode.Static;
btnDownloadVideos.AlternateText = "Download";
btnDownloadVideos.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png";
btnDownloadVideos.ValidationGroup = "";
btnAddToChannel = dataTab.Menu.NewImageButton();
btnAddToChannel.ID = "btnAddToChannel";
btnAddToChannel.ClientIDMode = System.Web.UI.ClientIDMode.Static;
btnAddToChannel.AlternateText = "AddToChannel";
btnAddToChannel.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_add_to_channel.png";
btnAddToChannel.ValidationGroup = "";
btnDeleteVideo = dataTab.Menu.NewImageButton();
btnDeleteVideo.ID = "btnDeleteVideo";
btnDeleteVideo.ClientIDMode = System.Web.UI.ClientIDMode.Static;
btnDeleteVideo.AlternateText = "Delete";
btnDeleteVideo.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_delete_video.png";
btnDeleteVideo.ValidationGroup = "";
this.pagerVideos.PageIndexChanged += pagerVideos_PageIndexChanged;
}
示例3: initPage
protected void initPage()
{
RegistedUser MySelf = new RegistedUser();
MySelf = (RegistedUser)Session["User"];
MySelf.Userservice = new UserServiceClasses.RegisterUserService();
List<Message> PublishMessageList = MySelf.Userservice.GetUserUreadPublicMessages(MySelf.UserName);
Panel single = new Panel();
foreach (Message singleMessage in PublishMessageList)
{
HyperLink MessageFrom = new HyperLink();
MessageFrom.Text = singleMessage.userFrom.NickName;
MessageFrom.NavigateUrl = "~/WebPage/UserOwnZonePage/UserOwnZonePage/UserOwnZonePage.aspx?VisitedUserID=" + singleMessage.userFrom.UserName; ;
single.Controls.Add(MessageFrom);
Label MessageCon = new Label();
MessageCon.Text = singleMessage.content;
single.Controls.Add(MessageCon);
ImageButton deleteButton = new ImageButton();
deleteButton.ImageUrl = "~/newpng/Trash.png";
deleteButton.Height = new Unit(48);
deleteButton.ID = singleMessage.ID.ToString();
deleteButton.OnClientClick += "DeleteItem";
deleteButton.Click += new ImageClickEventHandler(deleteButton_Click);
single.Controls.Add(deleteButton);
}
this.ALLPublicMessage.Controls.Add(single);
}
示例4: InitializeCell
public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
base.InitializeCell(cell, cellType, rowState, rowIndex);
if (cell == null)
{
throw new ArgumentNullException("cell");
}
ImageButton button3 = new ImageButton {
ID = "rise",
ImageUrl = this.RiseUrl,
CommandName = "Rise"
};
ImageButton child = button3;
ImageButton button4 = new ImageButton {
ID = "fall",
ImageUrl = this.FallUrl,
CommandName = "Fall"
};
ImageButton button2 = button4;
if (cellType == DataControlCellType.DataCell)
{
cell.Controls.Add(button2);
cell.Controls.Add(child);
}
}
示例5: SearchTask2Json
private void SearchTask2Json(string task)
{
DataTable dtSearchTask = Library.Data.JSONToDataTable(task);
int searchTotal = dtSearchTask.Rows.Count;
for (int i = 0; i < searchTotal; i++)
{
ImageButton imgBtn = new ImageButton();
imgBtn.ID = i.ToString();
imgBtn.ImageUrl = "/img/poster.png";
imgBtn.Width = 50;
imgBtn.Height = 50;
HyperLink hl = new HyperLink();
hl.ID = i.ToString();
hl.Text = dtSearchTask.Rows[i]["TaskTitle"].ToString();
Label lbl = new Label();
lbl.ID = i.ToString();
lbl.Text = dtSearchTask.Rows[i]["TaskDetail"].ToString()+"<br /> <hr />";
pnlSearchTask.Controls.Add(imgBtn);
pnlSearchTask.Controls.Add(hl);
pnlSearchTask.Controls.Add(lbl);
}
}
示例6: createTable
public void createTable()
{
Reservation reservation = (Reservation)Session["reservationBusy"];
List<WorkStation> busy = new List<WorkStation>(reservation.WsBusy);
int cont = 1;
int z = 0;
for (int i = 0; i < 6; i++)
{
TableRow tr = new TableRow();
myTable.Rows.Add(tr);
for (int j = 0; j < 5; j++)
{
TableCell tc = new TableCell();
tc.ID = "" + cont;
ImageButton btn = new ImageButton();
if (z < busy.Count)
{
if (busy[z].Busy == true)
{
btn.ImageUrl = "img/StationBusy.png";
btn.Enabled = false;
}
else
{
btn.ImageUrl = "Images/indice.png";
}
}
btn.Click += new ImageClickEventHandler(btn_Click);
tc.Controls.Add(btn);
tr.Cells.Add(tc);
cont++;
z++;
}
}
}
示例7: OnInit
protected override void OnInit(EventArgs e)
{
dataTab = this.TabViewDetails.NewTabPage("Videos");
dataTab.Controls.Add(this.tabVideos);
btnDownloadVideos = dataTab.Menu.NewImageButton();
btnDownloadVideos.ID = "btnDownloadVideos";
btnDownloadVideos.AlternateText = "Download";
btnDownloadVideos.ClientIDMode = System.Web.UI.ClientIDMode.Static;
btnDownloadVideos.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_download.png";
btnDownloadVideos.ValidationGroup = "";
btnRemoveFromChannel = dataTab.Menu.NewImageButton();
btnRemoveFromChannel.ID = "btnRemoveFromChannel";
btnRemoveFromChannel.AlternateText = "Remove from channel";
btnRemoveFromChannel.ClientIDMode = System.Web.UI.ClientIDMode.Static;
btnRemoveFromChannel.ImageUrl = GlobalSettings.Path + "/narnoo/distributors/icons/icons_remove_from_channel.png";
btnRemoveFromChannel.ValidationGroup = "";
this.pagerVideos.PageIndexChanged += pagerVideos_PageIndexChanged;
this.btnChangeChannel.Click += btnChangeChannel_Click;
}
示例8: ShowImages
public void ShowImages()
{
if (_images != null)
{
imgMain.ImageUrl = !_images[0].Contains("no-image.jpg") ? _images[0].Substring(0, _images[0].IndexOf(".jpg")) + "-main.jpg" : _images[0];
lnkImage.NavigateUrl = _images[0];
pnlThumbs.Controls.Clear();
if (_images.Count > 1)
{
for (int i = 0; i < _images.Count; i++)
{
ImageButton image = new ImageButton();
image.ID = "imgThumb" + i.ToString();
image.ImageUrl = !_images[i].Contains("no-image.jpg") ? _images[i].Substring(0, _images[i].IndexOf(".jpg")) + "-thumb.jpg" : _images[i];
image.CssClass = "thumb img-responsive";
//image.Click += new ImageClickEventHandler(image_Click);
image.OnClientClick = "changeImg(this.src);return false;";
pnlThumbs.Controls.Add(new LiteralControl("<div class='col-lg-4'>"));
pnlThumbs.Controls.Add(image);
pnlThumbs.Controls.Add(new LiteralControl("</div>"));
}
}
}
}
示例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);
}
示例10: Page_Load
protected void Page_Load( Object sender, EventArgs e )
{
try
{
UserInfo _UserInfo = UserController.GetCurrentUserInfo();
foreach( ModuleAction action in this.MenuActions )
{
if( action.CommandName == ModuleActionType.PrintModule )
{
if( action.Visible && PortalSecurity.HasNecessaryPermission( action.Secure, PortalSettings, ModuleConfiguration, _UserInfo.UserID.ToString() ) )
{
bool blnPreview = false;
if( Request.Cookies["_Tab_Admin_Preview" + PortalSettings.PortalId] != null )
{
blnPreview = bool.Parse( Request.Cookies["_Tab_Admin_Preview" + PortalSettings.PortalId].Value );
}
if( blnPreview == false || ( action.Secure == SecurityAccessLevel.Anonymous || action.Secure == SecurityAccessLevel.View ) )
{
if( PortalModule.ModuleConfiguration.DisplayPrint )
{
ImageButton ModuleActionIcon = new ImageButton();
if( !String.IsNullOrEmpty(PrintIcon) )
{
ModuleActionIcon.ImageUrl = PortalModule.ModuleConfiguration.ContainerPath.Substring( 0, ModuleConfiguration.ContainerPath.LastIndexOf( "/" ) + 1 ) + PrintIcon;
}
else
{
ModuleActionIcon.ImageUrl = "~/images/" + action.Icon;
}
ModuleActionIcon.ToolTip = action.Title;
ModuleActionIcon.ID = "ico" + action.ID;
ModuleActionIcon.CausesValidation = false;
ModuleActionIcon.Click += new ImageClickEventHandler( IconAction_Click );
this.Controls.Add( ModuleActionIcon );
}
}
}
}
}
// set visibility
if( this.Controls.Count > 0 )
{
this.Visible = true;
}
else
{
this.Visible = false;
}
}
catch( Exception exc ) //Module failed to load
{
Exceptions.ProcessModuleLoadException( this, exc );
}
}
示例11: OpenDialogForButtonWithLocation
public void OpenDialogForButtonWithLocation(ImageButton button, string message)
{
ScriptManager.RegisterClientScriptBlock(
button,
typeof(ImageButton),
DateTime.Now.ToString().Replace(":", " "),///使用当前时间作为标识
"alert('" + message + "');location='PaperLists.aspx'",
true);
}
示例12: CrearImagen
public ImageButton CrearImagen(String id, String cls, String url)
{
ImageButton imagen = new ImageButton();
imagen.ID = id;
imagen.CssClass = cls;
imagen.ImageUrl = url;
//imagen.Attributes.Add("runat", "server");
return imagen;
}
示例13: cargar_ofertas_academicas
public void cargar_ofertas_academicas()
{
Oferta[] ofertas = new Oferta().cargar_por_tipo("2");
for (int i = 0; i < ofertas.Length; i++)
{
TableRow fila1 = new TableRow();
TableCell celda = new TableCell();
celda.CssClass = "td";
celda.Text = ofertas[i].Oficio;
TableCell celda1 = new TableCell();
celda1.CssClass = "td";
celda1.Text = ofertas[i].Entidad;
TableCell celda2 = new TableCell();
celda2.CssClass = "td";
celda2.Text = Convert.ToDateTime(ofertas[i].Fecha).ToString("dd-MM-yyyy");
TableCell celda3 = new TableCell();
celda3.CssClass = "td";
celda3.Text = Convert.ToDateTime(ofertas[i].Fecha_limite).ToString("dd-MM-yyyy");
TableCell celda4 = new TableCell();
celda4.CssClass = "td";
HyperLink link = new HyperLink();
link.Text = "Ir a la oferta";
link.NavigateUrl = Global.ruta + "/mostrar_oferta.aspx?id=" + ofertas[i].Id;
celda4.Controls.AddAt(0, link);
TableCell celda7 = new TableCell();
celda7.CssClass = "td";
HyperLink link_usu = new HyperLink();
link_usu.Text = ofertas[i].Usuario;
celda7.Controls.AddAt(0, link_usu);
fila1.Cells.Add(celda);
fila1.Cells.Add(celda1);
fila1.Cells.Add(celda2);
fila1.Cells.Add(celda3);
fila1.Cells.Add(celda7);
fila1.Cells.Add(celda4);
TableCell celda5 = new TableCell();
celda5.CssClass = "td";
TableCell celda6 = new TableCell();
celda6.CssClass = "td";
if (ofertas[i].Cod_usuario.Equals(cod))
{
ImageButton edit = new ImageButton();
edit.ImageUrl = "~/Imagenes/edit.png";
edit.CommandName = ofertas[i].Id;
edit.PostBackUrl = "~/Paginas/editar_oferta.aspx?tipo=2&ofe=" + ofertas[i].Id;
celda5.Controls.AddAt(0, edit);
HyperLink link_eli = new HyperLink();
link_eli.Text = "<a href=\"ejemplo.htm\" target=\"_blank\" onClick=\"window.open('/Paginas/mensaje_eliminar.aspx?id=" + ofertas[i].Id + "&op=2', this.target, 'width=250,height=50,left=540,top=200,scrollbars=NO, resizable=NO'); return false;\"><img src=\"/Imagenes/eliminar_btn.png\"></a>";
celda6.Controls.AddAt(0,link_eli);
}
fila1.Cells.Add(celda5);
fila1.Cells.Add(celda6);
Table1.Rows.Add(fila1);
}
}
示例14: InitializeControls
protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
button = new ImageButton { ImageUrl = "", CommandName = CommandName };
button.SetId(ChildId);
if (Click != null) button.Click += Click;
cell.Controls.Add(button);
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
#region Interfaz
//Hashtable htbPermisos = (Hashtable)Session["permisos"];
//char cPermiso = (char)htbPermisos["estados"];
Master.FindControl("btnNuevo").Visible = false;
Master.FindControl("btnEliminar").Visible = false;
Master.FindControl("btnMostrar").Visible = false;
Master.FindControl("btnReportes").Visible = false;
Master.FindControl("rdbFiltro1").Visible = false;
Master.FindControl("rdbFiltro2").Visible = false;
Master.FindControl("rdbFiltro3").Visible = false;
Master.FindControl("btnBuscar").Visible = false;
Master.FindControl("txtBuscar").Visible = false;
Master.FindControl("lblBuscar").Visible = false;
//imbNuevo = (ImageButton)Master.FindControl("imgBtnNuevo");
//imbNuevo.Click += new ImageClickEventHandler(this.imbNuevo_Click);
imbEditar = (ImageButton)Master.FindControl("imgBtnEditar");
imbEditar.Click += new ImageClickEventHandler(this.imbEditar_Click);
//imbEliminar = (ImageButton)Master.FindControl("imgBtnEliminar");
//imbEliminar.Click += new ImageClickEventHandler(this.imbEliminar_Click);
//imbMostrar = (ImageButton)Master.FindControl("imgBtnMostrar");
//imbMostrar.Click += new ImageClickEventHandler(this.imbMostrar_Click);
//imbReportes = (ImageButton)Master.FindControl("imgBtnReportes");
//imbReportes.Visible = false;
imbAceptar = (ImageButton)Master.FindControl("imgBtnAceptar");
imbAceptar.Click += new ImageClickEventHandler(this.imbAceptar_Click);
imbAceptar.ValidationGroup = "Configuracion";
imbCancelar = (ImageButton)Master.FindControl("imgBtnCancelar");
imbCancelar.Click += new ImageClickEventHandler(this.imbCancelar_Click);
//rdbTodos = (RadioButton)Master.FindControl("rdbFiltro1");
//rdbTodos.Text = "Nombre y Clave";
//rdbTodos.Checked = true;
//rdbClave = (RadioButton)Master.FindControl("rdbFiltro2");
//rdbClave.Text = "Clave";
//rdbNombre = (RadioButton)Master.FindControl("rdbFiltro3");
//rdbNombre.Text = "Nombre";
//lblReportes = (Label)Master.FindControl("lblReportes");
//lblReportes.Visible = false;
//btnBuscar = (Button)Master.FindControl("btnBuscar");
//btnBuscar.Click += new EventHandler(this.btnBuscar_Click);
//txbBuscar = (TextBox)Master.FindControl("txtBuscar");
lblNombreModulo = (Label)Master.FindControl("lblNombreModulo");
lblNombreModulo.Text = "Cambiar Contraseña";
#endregion
if (!IsPostBack)
{
txbUsuario.Text = Session["usuario"].ToString();
txbUsuario.Enabled = false;
Habilita();
}
}