?
Solved

Thickbox postback

Posted on 2009-05-11
8
Medium Priority
?
2,786 Views
Last Modified: 2012-06-21
Hi,

Am using a thickbox to edit a comment in a control on a main page. The following closes the thickbox with no problems, I just need the main page to do a postback to show the changes in the control.

'This is placed in the main page to open the thickbox.
<asp:HyperLink NavigateUrl="EnterDayNote.aspx" CssClass="thickbox" ID="hypEditDayNote" runat="server" >
                <asp:ImageButton ID="btnEditDayNote" ImageUrl="~/Images/imgPencil.png" CausesValidation="false" runat="server" ToolTip="Edit Note for selected date." />
</asp:HyperLink>

'This is placed in the code behind load event on the thickbox page.
Me.btnAdd.Attributes.Add("href", "#")
Me.btnAdd.Attributes.Add("onclick", "self.parent.tb_remove();return false;")

Any ideas on how this can be accomplished would be greatly appreciated.

Thanks

   
0
Comment
Question by:Higgster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 11

Expert Comment

by:Muhammad Ousama Ghazali
ID: 24354060
Any one or both of the following on the Me.btnAdd.Attributes.Add("onclick", "self.parent.tb_remove();return false;") may allow postback:
  1. Replace return false; with return true;
  2. Remove return false; altogether.
Hope this helps.
0
 

Author Comment

by:Higgster
ID: 24354143
Hi,

Thanks, I have given that a go (both) but I am not taken back to the main page, instead the thickbox is closed and the edit page is then loaded into the browser.

Cheers.
0
 
LVL 11

Expert Comment

by:Muhammad Ousama Ghazali
ID: 24355196
Update your code as in snippet and see if it works.

Me.btnAdd.Attributes.Add("onclick", "self.parent.tb_remove();" & Page.ClientScript.GetPostBackEventReference(btnAdd, "") & ";")

Open in new window

0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:Higgster
ID: 24355362
Thanks, Same thing I'm afraid. Reloads the edit page into the browser.
0
 
LVL 11

Accepted Solution

by:
Muhammad Ousama Ghazali earned 1600 total points
ID: 24356651
I just re-read carefully what your requirements are and got to know that I was mistaken in understanding what actually is need in your situation.

Anyways, now what I understand in simplest terms is that you wish to refresh (reload) the parent page from where the thickbox is being initiated. It was actually a simple JavaScript code one variant of which also came earlier to mind but due to misunderstanding did not post. However, here is the solution for you (see snippet).

For more on reloading/refreshing the page using JavaScript can be found here: http://www.grizzlyweb.com/webmaster/javascripts/refresh.asp

For more discussion on thickbox related to postbacks see these links too:
http://www.steve-oh.com/blog/index.php/2008/06/28/thickbox-31-within-aspnet-updatepanel/
http://mwtech.blogspot.com/2009/05/using-thickbox-with-server-side-buttons.html

Me.btnAdd.Attributes.Add("onclick", "self.parent.tb_remove();self.parent.location.reload(true);return false;")

Open in new window

0
 

Author Comment

by:Higgster
ID: 24356997
Thanks again, this does bring me back to the original page but does bring with it an annoying msg.

"To disply the web page again, internet explorer needs to resend the information you've previously submitted.

If you were making a purchase, you should click cancel to avoid a duplicate transaction. Otherwise, click retry to display the web page again."

Do you know a way round this?

Thanks.

0
 
LVL 11

Expert Comment

by:Muhammad Ousama Ghazali
ID: 24359126
Try using self.parent.location.reload(false); instead in the code. If it still presents you the annoying message, please attach a screen shot for better understanding.

If the above still does not work, try this instead too:

self.parent.location.replace(self.parent.location.pathname);
0
 

Author Comment

by:Higgster
ID: 24359847
OK, the second option seemed to do a little better, it refreshed the page but got rid of all textbox values, though I'm sure I can overcome that. gettin a little late now so i'll look in to that tommorow and get back you.

Cheers.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question