|
-
Jan 31st, 2004, 11:10 AM
#1
Thread Starter
Lively Member
Retry after pop window
I have a page that has a DataGrid on it. Sorting is enabled on the grid. Now with that, here is my problem. Step by Step.
1) I click on a heading to sort the grid.
2) I click on a link that pop's a new window using the following java script
window.open(POPurl+'?'+strVal,'NewWindow','height=320,width=500,status=no,toolbar=no,menubar=no,loca tion=no,resizable=yes,scrollbars=no');
3) Finsh work on Popup window and click close which runs the following code behind code.
Response.Write("<script>window.opener.location.reload();window.close();</script>")
4) I then receive this error
"The page cannot be refreshed without resending the information.
Click Retry to send the information again, or click Cancel to return to the page that you were trying to view"
5) I click Retry and the page with the grid displays fine.
Here is my question, how do I get rid of the error in step 4? It only happens if I sort the grid before going to the pop up window. The page does need to be refreshed when I close out of the pop up window.
Thanks
-
Jan 31st, 2004, 04:21 PM
#2
PowerPoster
You are going to have a hard time fixing that. There is a very good reason for this happening.
When you click the datagrid column to sort, you are POSTING back to the server. When you do that, you are sending information to the server, which includes the controls data, viewstate, etc....
What you are asking for the page to do is refresh the page. But in order to refresh the page, then that data has to be reposted to the server. IE tells you so (I think more for security reasons).
The current way you are doing it probably won't work. But, lets say you cause the form to post back with the javascript, instead of refreshing it, then the page will post back to the server just fine. You need to figure out how the controls are causing post backs, and you need to do the same.
-
Feb 1st, 2004, 09:23 PM
#3
Thread Starter
Lively Member
Thanks Hellswraith, This is an app I took over. The current app uses this java script to pop a window. This window makes the app flow very well. I understand that .NET does not have this same capability, BUT, does it have something like it? What do you use when you need to do a "pop up"?
Thanks
-
Feb 2nd, 2004, 12:00 AM
#4
PowerPoster
The pop up is fine, you just need to do a postback instead of a refresh. Once you do a post back, you won't get that ugly message.
-
Feb 2nd, 2004, 12:02 AM
#5
PowerPoster
Code:
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document.NewReply;
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
That is the java script I have on one of my forms that does the submit, so if you just call that method, instead of doing a refresh, you should avoid the message.
-
Feb 2nd, 2004, 08:53 AM
#6
Thread Starter
Lively Member
Thanks, this is very helpful. One last question, I am a beginner in JavaScript.
What do the arguments “eventTarget” and “eventArgument” represent?
Thanks!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|