I bind records using RadGrid, and each row it has a link
button. If I click the link, it will open the moalpopup (it is dynamic
one based on some condition). When I close the popup using close button,
it should continue with the link button event.
Code Behind:
protected void grid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
{
LinkButton link = ((LinkButton)gridDataItem.FindControl("link"));
ModalPopupExtender popup = (ModalPopupExtender)e.Item.FindControl("popup");
Image imageClose = (Image)e.Item.FindControl("imageClose");
popup.TargetControlID = link.ID;
link.Attributes.Add("onclick", "return false;"); // to avoid postback and stay in page and show popup
imageClose.Attributes.Add("onclick", "proceed('" + link.ClientID + "')");
}
}
Javascript:
function proceed(id)
{
window.document.getElementById(id).removeAttribute("onclick"); // Link button - to remove "onclick" attribute
window.document.getElementById(id).click(); // trigger click event
}
I tried with the above code, the attribute not removed and not continue with link button event.