【发布时间】:2015-09-15 12:56:08
【问题描述】:
我在页面顶部有一个 JavaScript 函数,我希望它从 gridview 中的 ButtonField(类型:图像)调用,但我不能,因为 OnClick 不可用。怎么做 ?
<asp:ButtonField CommandName="cmdDelete" ImageUrl="~/assets/global/images/shopping/delete.png" ButtonType="Image" ControlStyle-Width="25px" ControlStyle-Height="20px" />
功能:
function GetConfrim() {
if (confirm("Are You Sure ?")) {
return true;
} else {
return false;
}
}
并且按钮后面的事件应该只有在我按下是时才会运行,否则不会。
if (e.CommandName == "cmdDelete")
{
MngPropertyDetails.DeletePropertyDetails(PropertyDetailsID);
ResultLabel.ResultLabelAttributes("Record Delete Successfully!", ProjectUserControls.Enums.ResultLabel_Color.Green);
ShowPropertyDetails();
}
此代码在 RowCommand 事件中。
【问题讨论】:
标签: javascript c# asp.net webforms