如您所见,这是在数据表行上完成的
foreach(LinkCustomerFile lcf in linkedCustomerFiles)
{
var readLinkType = ecfsc.GetLinkType(lcf.LinkType.LinkTypeId,DateTime.Now,Page.User.Identity.Name);
dt.Rows.Add("7","45",readLinkType,string.Format("<a href='../LinkCustomerFiles.aspx?action={0}&customerFileId={1}&referenceNumber={2}&linkcustId={3}' target='popup'>{0} </a> ","Remove",lcf.CustomerFile.CustomerFileId,lcf.RefCustomerFile.CustomerFileId,lcf.LinkCustomerFileId));
}
RadGridLink.DataSource=dt;
RadGridLink.DataBind();
当用户单击删除
时,是否可以通过此代码来实现弹出窗口?答案 0 :(得分:0)
只需少量添加代码即可。
第一个)。只需直接在代码的OnClick属性上添加JavaScript代码即可。
@foreach(LinkCustomerFile lcf in linkedCustomerFiles)
{
var readLinkType = ecfsc.GetLinkType(lcf.LinkType.LinkTypeId,DateTime.Now,Page.User.Identity.Name);
dt.Rows.Add("7","45",readLinkType,string.Format("<a href='../LinkCustomerFiles.aspx?action={0}&customerFileId={1}&referenceNumber={2}&linkcustId={3}' target='popup' onclick='return confirm('Are you sure you want to Logout?')'>{0} </a> ","Remove",lcf.CustomerFile.CustomerFileId,lcf.RefCustomerFile.CustomerFileId,lcf.LinkCustomerFileId));
}
RadGridLink.DataSource=dt;
RadGridLink.DataBind();
2nd)另一种方法是添加Javascript代码:
<script>
function myFunction() {
return confirm('Are you sure you want to Logout?')
}
</script>
然后直接在代码中调用该函数:
@foreach(LinkCustomerFile lcf in linkedCustomerFiles)
{
var readLinkType = ecfsc.GetLinkType(lcf.LinkType.LinkTypeId,DateTime.Now,Page.User.Identity.Name);
dt.Rows.Add("7","45",readLinkType,string.Format("<a href='../LinkCustomerFiles.aspx?action={0}&customerFileId={1}&referenceNumber={2}&linkcustId={3}' target='popup' onclick='myFunction()'>{0} </a> ","Remove",lcf.CustomerFile.CustomerFileId,lcf.RefCustomerFile.CustomerFileId,lcf.LinkCustomerFileId));
}
RadGridLink.DataSource=dt;
RadGridLink.DataBind();