我在网格视图中有一个模板字段,代码编写如下:
<asp:TemplateField HeaderStyle-Width="40px" HeaderStyle-Font-Underline="false" ItemStyle-HorizontalAlign="Center" HeaderText="" >
<ItemTemplate>
<a href="javascript:fillBankDetails(<%# CreateBankDetailsArray(DataBinder.Eval(Container, "DataItem")) %>);window.close();" >Select</a>
</ItemTemplate>
</asp:TemplateField>
和javascript函数写如下
function fillBankDetails(bankDetails) {
alert('Hello');
isSelected = true;
var a = JSON.parse(bankDetails);
window.returnValue = a
}
HTML code:
<a href="javascript:fillBankDetails([{"BankName":"AB BANK LIMITED","FullConnectedBicCode":"ABBLBDDH002","RoutingCode":"","PostalCode":"","Address1":"102, KAZI NAZRUL ISLAM AVENUE","Address2":"","Address3":"","City":"DHAKA","IbanNumber":"","ProvinceState":"","AccountNumber":"","CountryCode":"BD","IsFoundInDb":"true","bicSuccessMessage":"Bank details are filled from a selected record.","bicWarningMessage":"SWIFT (BIC) code is valid, but no record was selected. Please enter bank details manually.","recordCount":1,"selectMultiple":"1","PrimaryKey":"BD000000003I"}]);window.close();" >Select</a>
当我点击选择时,点击事件不会触发。我做错了吗?请帮忙。 提前谢谢。