By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

Force Gridview on parent web page to refresh

P: n/a
I have a web page "PgA" with a GridView. I open another page "PgB" in a new
window. On PgB, they do some things that affect the underlying data for the
GridView on PgA. When the user is done with PgB, they click a button that
executes this VB:
Protected Sub Close_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Close.Click
'Do some stuff
Response.Write("<script language='javascript'{
window.close();}</script>")
'What code goes here to force the GridView on PgA to refresh?
End Sub
Now, because some of what they did on PgB has affected the underlying data
for the GridView on PgA, I need to cause the GridView to refresh, without
reloading the entire page.
In VB, what code do I use?

I was able to use this:
opener.window.location=opener.window.location;self .close();

However, that causes the entire page to reload. I only want the GridView to
reload. Within Javascript on the Child page, can I somehow execute a
specific routine on the parent page? The routine contains the code I need to
execute.
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

AspNet is not build to use popup or whatever other kind of seperate windows.

Cor

"SilkCityFlorida" <Si*************@discussions.microsoft.comschree f in
bericht news:7D**********************************@microsof t.com...
>I have a web page "PgA" with a GridView. I open another page "PgB" in a
new
window. On PgB, they do some things that affect the underlying data for
the
GridView on PgA. When the user is done with PgB, they click a button that
executes this VB:
Protected Sub Close_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Close.Click
'Do some stuff
Response.Write("<script language='javascript'{
window.close();}</script>")
'What code goes here to force the GridView on PgA to refresh?
End Sub
Now, because some of what they did on PgB has affected the underlying data
for the GridView on PgA, I need to cause the GridView to refresh, without
reloading the entire page.
In VB, what code do I use?

I was able to use this:
opener.window.location=opener.window.location;self .close();

However, that causes the entire page to reload. I only want the GridView
to
reload. Within Javascript on the Child page, can I somehow execute a
specific routine on the parent page? The routine contains the code I need
to
execute.

Jun 27 '08 #2

P: n/a
On Jun 6, 5:58*pm, SilkCityFlorida
<SilkCityFlor...@discussions.microsoft.comwrote:
I have a web page "PgA" with a GridView. *I open another page "PgB" in anew
window. *On PgB, they do some things that affect the underlying data forthe
GridView on PgA. *When the user is done with PgB, they click a button that
executes this VB:
* * *Protected Sub Close_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Close.Click
* * * * 'Do some stuff
* * * * Response.Write("<script language='javascript'{
window.close();}</script>")
* * * * 'What code goes here to force the GridView on PgA to refresh?
* * End Sub
Now, because some of what they did on PgB has affected the underlying data
for the GridView on PgA, I need to cause the GridView to refresh, without
reloading the entire page.
In VB, what code do I use?

I was able to use this:
opener.window.location=opener.window.location;self .close();

However, that causes the entire page to reload. *I only want the GridView to
reload. *Within Javascript on the Child page, can I somehow execute a
specific routine on the parent page? *The routine contains the code I need to
execute.
I added an Input button to my page with this in the Page Load code
behind:
Dim strScript As String =
"<script>window.opener.document.forms(0).submit(); </script>"
ClientScript.RegisterClientScriptBlock(Me.GetType, "script",
strScript)
This closes the popup window

Add a second ASP button that executes an update on your Grids
datasource i.e.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

If Page.IsValid Then

'INSERT INTO yourdatabase (a, b, c) VALUES (@a, @b,
@c)
SqlDataSource2.InsertCommand = strSQL
SqlDataSource2.Insert()
Endif

End Sub

This will cause your Grid to update as the datasource has been updated.
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.