tags:

views:

33

answers:

1

Hi All!

I have an updatepanel,a modal popup extender inside that and an image button to open the pop up(it has not any click event). The 'div' for the modal pop up is outside the updatepanel. In the modal pop up the records come in a table with a link in each table row.When the link is clicked,a javascript function causes a hidden control to postback and fetch values from database.First time it is working fine,but next time the image button(TargetControlID for modal pop up extender) does not work and it is causing a postback and loading the page.Help plz... Thanks in advance. Mohak

A: 

Are you using myLink.ClientID or did you hardcoded the ID of the link in the Javascript function?

The ID of the link is probably changed when doing the first postback, the second time ASP.NET has generated a new ID (not visible in the HTML because of the AJAX-request) for your link and this doesn't match anymore with the ID in your Javascript function.

The solution would be to use myLink.ClientID

thomasvdb
Hi thomasvdb!Thanks for ur reply. the javascript causes the post back of a hidden control as follows.var hdId = $get('<%= hdnLinkSource.ClientID %>'); hdId.value = linkSrcIdName; __doPostBack('ctl00_ContentPlaceHolder1_hdnLinkSource', "");
Mohak
function GetLinkSourceIdName(linkSrcIdName) { var hdId = $get('<%= hdnLinkSource.ClientID %>'); hdId.value = linkSrcIdName; __doPostBack('ctl00_ContentPlaceHolder1_hdnLinkSource', ""); }
Mohak
It is called form web method that create the table for the pop up sb.Append("<a href='javascript: void(0)' name='"+ Convert.ToString(linkSourceList[i].Name) + "/" + linkSourceList[i].Id + "' onclick='GetLinkSourceIdName(this.name)' id='lnk" + i.ToString() + "' class='activation'>" + Convert.ToString(linkSourceList[i].Name) + "</a>");
Mohak
Try to call your method again in your postback so it "rebuilds" your Javascript with the new ClientID.
thomasvdb