[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2811
  • Last Modified:

Thickbox postback

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
Higgster
Asked:
Higgster
  • 4
  • 4
1 Solution
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
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
 
HiggsterAuthor Commented:
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
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
HiggsterAuthor Commented:
Thanks, Same thing I'm afraid. Reloads the edit page into the browser.
0
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
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
 
HiggsterAuthor Commented:
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
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
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
 
HiggsterAuthor Commented:
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now