[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Thickbox postback

Posted on 2009-05-11
8
Medium Priority
?
2,797 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
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…

650 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