Solved

Thickbox postback

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

Author Comment

by:Higgster
ID: 24355362
Thanks, Same thing I'm afraid. Reloads the edit page into the browser.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now