如何获取这个ID,速度结贴
<html>
<body>
<form runat= "server ">
<asp:Button id= "BT1 " runat= "server " OnClick= "send_Click "/>
<asp:Button id= "BT2 " runat= "server " OnClick= "send_Click "/>
<asp:Button id= "BT3 " runat= "server " OnClick= "send_Click "/>
<asp:Button id= "BT4 " ruant= "server " OnClick= "send_Click " />
</form>
</body>
</html>
void send_Click(object sender,EventArgs e)
{
//如何获取当前点击的Button的ID
//或请高手指点方法
//自己获取当前点击ID。
????
}
------解决方案--------------------void send_Click(object sender,EventArgs e)
{
//如何获取当前点击的Button的ID
//或请高手指点方法
//自己获取当前点击ID。
????
if(sender is button)
{
Button btn = sender as Button
btn.Id....
}
}
------解决方案--------------------try
Response.Write(((Button)sender).ID);