button.aspx.cs

来自「互联网程序设计的课程」· CS 代码 · 共 41 行

CS
41
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class backup_button : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void Button_Click(object sender, CommandEventArgs e)
    {
        string argName = e.CommandName;

        //CommandEventArgsr为一个类,故CommandArgument.ToString();
        string argArg = e.CommandArgument.ToString();
        Label2.Text = "您选中的为:<font color=red>" + argName + "</font>,带的数据是:<font color=red>" + argArg + "</font>";


    }


    protected void Button_Click(object sender, EventArgs e)
    {
        string argName = ((Button)sender).CommandName;

        //sender为一个对象,故CommandArgument为string
        string argArg = ((Button)sender).CommandArgument;
        Label1.Text = "您选中的动作为:<font color=red>" + argName + "</font>,带的数据是:<font color=red>" + argArg + "</font>";


    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?