How refresh gridview when open link to _blank target?

ASP.NET email web app...

Gridview with inbox of emails and "View Message" template column.  All "unread" messages have yellow as the color for the gv row.  When you click on "View Message" it opens the message in a new window basically.

I would like to automatically refresh the gridview after they click on the "View Message" link.  How can I do this?

The gridview "View Message" column is defined as follows...
                <asp:TemplateField HeaderText="Msg" ItemStyle-Width="10px">
                        <asp:HyperLink ID="hlViewMsg" Target="_blank" runat="server" NavigateUrl='<%# Eval("MsgId", "autoactions.aspx?action=mark_as_read&msgid={0}") %>'
                            Text='Open' Visible='True') %>'></asp:HyperLink>

Autoactions.aspx basically marks the db record as "read" then redirects to the message contents.  
Who is Participating?

Improve company productivity with a Business Account.Sign Up

spprivateConnect With a Mentor Commented:
The example I have is for a check box in grid view.But you can do the same for link

protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
CheckBox CheckBox1 = (CheckBox)e.Row.FindControl("CheckBox1");
CheckBox1.Attributes["onclick"] = string.Format("alert({0});",

Open in new window

Just have a javascript function

say function mysubmit()


register this event as a click event for the link
Here is a good link to handle postbacks in java script
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

RobertNZanaAuthor Commented:
Can you provide an example of registering the event as a click event for the link?  Remember the link is a template field in a gridview...
RobertNZanaAuthor Commented:
I'm dont know js.  So, instead of "alert" I would call "mysubmit"?  That will refresh the page basically?  Thanks!
RobertNZanaAuthor Commented:
I ended up doing this...

            Dim l As HyperLink = CType(e.Row.FindControl("hlViewFile"), HyperLink)
            l.Attributes.Add("onClick", "window.location.reload()")

Since you started the good ideas flowing i will credit u.  Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.