的html代码:jQuery的Asp.net按钮禁用
<asp:Button runat="server" ID="btnTest" Text="Test" OnClick="btnTest_Click" />
jQuery代码:
$('[id$=btnTest]').click(function(){
$('[id$=btnTest]').attr('disabled', 'true');
});
代码隐藏:
protected void btnTest_Click(object sender, EventArgs e)
{
//here not come.
}
代码为btnTest事件背后不行?
你需要知道你的'在JS按钮ClientID'。它与ID不同,但是像'ctl00_Content1_btnTest',如果你使用masterpage的话。 – 2010-05-25 14:57:06
问题是你必须设置'disabled =“disabled”'属性而不是'disabled =“true”'。 – 2010-05-25 15:01:04