62,067
社区成员
发帖
与我相关
我的任务
分享
//没有ID的Button点击事件
protected void Unnamed1_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
if (btn != null)
{
string text = btn.Text;
string id = btn.ID;//ID为null
}
}
//EX:写在Click事件中
Button btn = sender as Button;
if(btn != null)
{
string txt = btn.Text;
string id = btn.ID;
}