C++ C++ C# C# ASP.NET Security ASP.NET Security ASM ASM Скачать Скачать Поиск Поиск Хостинг Хостинг  
  Программа для работы с LPT портом...
Язык: .NET — ©Alexey...
  "ASP.NET Atlas" – AJAX в исполнении Micro...
Язык: .NET — ©legigor@mail.ru...
  "Невытесняющая" Многопоточность...
Язык: C/C++ — ©...
  Update World C++: Сборник GPL QT исходников
  Весь сайт целиком можно загрузить по ссылкам из раздела Скачать
Дебетовая карта Home Credit [CPS] RU

 ImageButton Control in ASP.NET / Custom Controls / ASP. NET

Sample Image - imageButtons.gif

Introduction

As you know, in the ASP.NET ImageButton can not be displayed as disabled. I have written the below code in order to solve this problem.

With this control you can easily show a disabled ImageButton. You can assign four different values for imageURL in this control.

  1. ImageURL
  2. DisableImageURL
  3. MouseOverImageURL
  4. MouseOutImageURL

The code

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace ImageButtonTest
{
    /// <SUMMARY>
    /// Summary description for WebForm1.
    /// </SUMMARY>

    public class WebForm1 : System.Web.UI.Page
    {

        protected msWebControlsLibrary.ExImageButton btnSave;
        protected msWebControlsLibrary.ExImageButton btnCancel;
        protected msWebControlsLibrary.ExImageButton btnNew;
        protected msWebControlsLibrary.ExImageButton btnDelete;
        protected msWebControlsLibrary.ExImageButton btnSearch;
        protected System.Web.UI.HtmlControls.HtmlGenericControl divMain;
        protected System.Web.UI.WebControls.TextBox kontrol;

        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here

            if (!Page.IsPostBack)
            {
                changedefault();
            }
        }

        #region Web Form Designer generated code

        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET 
            // Web Form Designer.
            //

            InitializeComponent();
            base.OnInit(e);
        }

        /// <SUMMARY>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </SUMMARY>

        private void InitializeComponent()
        {    
            this.btnSave.Click += new 
                    System.EventHandler(this.btnSave_Click);
            this.btnCancel.Click += new 
                    System.EventHandler(this.btnCancel_Click);
            this.btnNew.Click += new 
                    System.EventHandler(this.btnNew_Click);
            this.btnDelete.Click += new 
                    System.EventHandler(this.btnDelete_Click);
            this.btnSearch.Click += new 
                    System.EventHandler(this.btnSearch_Click);
            this.Load += new System.EventHandler(this.Page_Load);
        }

        #endregion

        #region ToolBarButton Events

        private void changeallfalse()
        {
            btnSave.Enabled      = false;
            btnDelete.Enabled = false;
            btnNew.Enabled = false;
            btnCancel.Enabled = false;
            btnSearch.Enabled = false;  
        }

        private void changeupdate()
        {
            if (kontrol.Text!="0" )
            {
                btnSave.Enabled = true;
                btnDelete.Enabled = true;
                btnNew.Enabled = true;
                btnCancel.Enabled = true;
                btnSearch.Enabled = true;

                kontrol.Text = "2";
            }

        }

        private void changenew()
        {

            btnSave.Enabled      = true;
            btnDelete.Enabled = false;
            btnNew.Enabled = false;
            btnCancel.Enabled = true;
            btnSearch.Enabled = false;

            kontrol.Text = "1";
        }
          
        private void changenavigate()
        {
            btnSave.Enabled      = false;
            btnDelete.Enabled = false;
            btnNew.Enabled = true;
            btnCancel.Enabled = true;
            btnSearch.Enabled = true;
        }

        private void changedefault()
        {
            btnSave.Enabled      = false;
            btnDelete.Enabled = false;
            btnNew.Enabled = true;
            btnCancel.Enabled = true;

            kontrol.Text = "0";
            btnSearch.Enabled = true;

        }

        #endregion

        #region ToolBarButton ClickEvents

        private void btnSave_Click(object sender, System.EventArgs e)
        {

        }

        private void btnCancel_Click(object sender, System.EventArgs e)
        {
            changedefault();
        }

        private void btnNew_Click(object sender, System.EventArgs e)
        {
            changenew();
        }

        private void btnDelete_Click(object sender, System.EventArgs e)
        {

        }

        private void btnSearch_Click(object sender, System.EventArgs e)
        {
            if (kontrol.Text=="2") { changedefault();return; }
            kontrol.Text = "0";

            btnCancel .Enabled = false;
            btnSave.Enabled      = false;

        }

        #endregion
    }
}



Дебетовая карта Home Credit [CPS] RU