Solved

Thickbox postback

Posted on 2009-05-11
8
2,777 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
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!

 

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 400 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
async questions 5 48
display data from multiple ajax calls 9 41
Leaflet map example works but I want to make a change to it 5 27
Ajax calendar distorted 4 17
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

734 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