I have a GridView inside an UpdatePanel. Also on the page is a button, that when the user clicks opens up a modal dialog box. After the user selects an item from the dialog box, the dialog closes which triggers a javascript function. The purpose of this javascript function is to re-bind the GridView, thereby displaying the item just selected from the dialog box.
The javascript function simply triggers a hidden linkbutton that also resides inside the UpdatePanel.
The javascript code:
document.getElementById('ctl00_Main_LinkButton1').click();
The LinkButton code:
ProtectedSub LinkButton1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles LinkButton1.Click
GridView1.DataBind()
EndSub
This all works fine under IE6. The problem just started when I upgraded to IE7. The LinkButton is no longer getting triggered, so the GridView doesn't update. I've tried this with both the Atlas release, and the Ajax Beta 2 release. Neither seems to do what I want with IE7.
One other thing, if I remove the UpdatePanel from the page entirely, and force a full page refresh, it works fine with IE7.
Has anyone else noticed this? Any ideas on a work around?
hello.
try using fiddler to see the error you're getting.
I downloaded and ran Fiddler, but can see no errors.
I have many apps that use the similar method, and it works in IE6, IE7 and Firefox v2.0 and Apple Browser (don't remember the name - Safari?) hmmm who cares.
Try put your LinkButton outside the update panel.
WS
p.s: my apps use button instead link button. AND I don't use modal window, because it's not supported by many browsers. Instead, I use floating div. Good Luck.
I think the key difference with your solution is that all the logic resides in one page (with the use of floating div). I have tried adding a linkbutton outside the updatepanel, but this makes no difference in my solution.
With the modal dialog, I can trigger the javascript function when the dialog is closed. I tested this my triggering an Alert from my javascript function, so I know the function is being called when I close the dialog.
I next tried adding an HTML Input button outside the updatepanel:
<inputid="Button1"type="button"value="button"onclick="javascript:document.getElementById('LinkButton1').click();"/>
When I clicked this button, itdid trigger a refresh. I'm just not sure why it won't do it automatically once the dialog box is closed. Again, I've proven that the function is being called when the dialog is closed. I'm wondering if this isn't some IE 7 security issue. I've played around with the permissions a bit, but still have no joy.
For what it's worth,
I finally found a solution to my problem. I did a little digging into the JS file for the AJAX ModalPopup control, and modified my javascript accordingly:
window.setTimeout(
"document.getElementById('ctl00_Main_LinkButton1').click();", 0);Now works with both IE6 and IE7.
Thanks to all for your responses.
No comments:
Post a Comment