Erik Lenaerts

Do, or do not. There is no try. - Yoda

ASP.Net Thickbox control

On a regular basis we needed the thickbox functionalities on our ASP.Net web sites. I'm a fan of the thickbox implementation from Codey Lindley. We wanted to make this functionality easier to consume in ASP.Net so we decided to package this functionality into an Server Control as we did last time with the tooltip control.

Again, I'm not taking any credit here, just spreading the word :)

Thnx Wannes & Didr for helping me out here to develop this control.

Download the complete code (Visual Studio 2005 Solution) here

Download the control's Assembly here 

Edit : Source code including button support from Madas

Comments

James said:

Hey guys, nice work. Have you had to handle dealing with postbacks and interacting with an IFrame style?

Eg you popup a thickbox iframe that is a login control and allow your user to login to a site. What you'd like to have happen is that if the login is successful the main page is redirected to the right logged in page. what happens right now of course is the redirection happens in the iframe which is not the result.

Any ideas?

# August 23, 2007 4:59 PM

ErikL said:

Hi,

You need to revert to Javascript code to either close the thickbox or to redirect the main page. Here are some examples:

Redirect main page:

top.window.location = 'http://www.google.com/'

Close thickbox:

self.parent.tb_remove();

hope this helps a bit

# August 29, 2007 1:27 AM

madas said:

Is there a way to get the Asp .net thickbox working with a asp button.

for example: I press the button and then the grey box will show.

Thx

# August 31, 2007 8:24 AM

Femi said:

Hi guys, many thanks for this excellent control!! As usual it works perfectly well on my machine, but as soon as I run it on server 2003 "InvalidOperationException: The WebResource.axd handler must be registered in the configuration to process this request.

" and of course adding to the httphandlers <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />

doesn't seem to help?? Any ideas??

# September 6, 2007 9:47 PM

ErikL said:

Hi Madas,

sure, it's quit easy to do so. Make sure you have the source code at hand to make the necessary changes.

When you open the solution, look at the project called "com.dotnet6.controls.thickbox". Take a look at "ThickBoxImage.cs", this file implemented the thick box features on top of the standard HTML img tag. You can copy this file and call it for example "ThickBoxButton.cs" and make the necessary changes to render a HTML input class with type=button.

Make sure that you change the class attributes too.

Recompile the source code and use this Control Assembly in your Web projects.

if you need any help, don't hesitate to contact us.

# September 10, 2007 4:13 AM

ErikL said:

Femi,

mmh, haven't encountered that yet. You can check the following:

1) run "aspnet_regiis -i" from a visual studio command prompt, to re-register ASP.NET mappings

2) be sure the site runs under .NET 2.0

3) Ensure that you don't have any .NET 1.1 apps running in the same App Pool under IIS

# September 10, 2007 4:18 AM

madas said:

Hi ErikL,

now i have finished the button versions of the asp .net thickbox controls.

I would like to send you the files, but unfortunately i dont have your email. So i have upped it at rapidshare.

You can download them and add to the project.

rapidshare.com/.../com.dotnet6.controls.ThickBox.zip.html

thx

# September 18, 2007 9:22 AM

Marc said:

Hi,

I try to implement this in an ASP.NET AJAX application.

The Thickbox component is in a datagrid which resides in an UpdatePanel. The Thickbox  popup does not work after the page content has been refreshed through UpdatePanel.Update().

Any suggestions?

many thanks in advance.

Marc

info@fit2page.nl

# September 20, 2007 3:15 AM

ErikL said:

thnx Madas!

I uploaded and changed the original post to include your code.

:)

# September 20, 2007 5:07 AM

Mustafa Ismail Mustafa said:

Just what I was looking for!  Thanks!

On a different note and not to sound too much like a n00b, can you actually post [somewhere] a working example of how you're use the ThickBox.NET control?  I've imported into my page but I just can't get it to present any of my images in the gallery.

PS. My website is still under construction and I'd love to use this control there if I'm permitted to.

# December 28, 2007 5:06 PM

ErikL said:

Hi Mustafa,

a while ago i started on a demo site, luckily I already added the Thickbox on it.

check it out at http://demo.dotnet6.com/

grtz

# January 9, 2008 4:53 AM

Yohan said:

Hi,

My first impression of this is that this is a truly amazing control.  We had decided on using jQuery, but had issues because we have some heavy functionality such as form processing with multiple tabs on the thickbox.  With just the regular jQuery, on a postback, the thickbox use to close.  With this control the focus stays on it.

However below are 2 issues we are facing:

1. We have a .aspx page and it opens fine in the thickbox window.  However, at the right margin there is a think white margin which appears, and we have tried many options of playing with the thickbox.css, but to no avail.  I was able to make the top margin disappear, but not the right.

2. We have our own header image, so wanted to do away with the default title.  We changed the TB_Title CSS class and made height as 0px.  This works well with IE, but not with FF and Safari.  Is there any way this can be removed?

# April 11, 2008 10:00 AM

mmaestro said:

Hi,

Great control. I have one question. I would like to call Thickbox from button event that is not part of thickbox is this possible?

Example: I have one textbox and one button and ThickBoxInputInline. When button is pressed I set ThickBoxContent and ThickBoxTitle but I do not like to press one more time button Show inline content I would like to call this event from my button.

I hope this is possible.

Thanks in advance.

Kind regards.

# April 13, 2008 11:53 PM

ErikL said:

Yohan: tbh, I did some trails myself but without any success also. My css knowledge is not good enough for this task I'm afraid. what I suggest is to try to figure out how to approach it using default thickbox from jquery.com/.../thickbox

# April 14, 2008 1:06 AM

ErikL said:

mmaestro: You can create your own aspx wrapper around thickbox since my source code is included.

My advice would be to create a copy of the "ThickBoxInline.cs" class and call it f.ex "ThickBoxInlineButton.cs". Base this new class on the code you can find at jquery.com/.../thickbox. Scroll down to the inline content demo and view the demo html. gl

# April 14, 2008 1:10 AM

mmaestro said:

I was looking to your code. Actually I would like just get button event which triger to thickbox is shown. I could not find any event which trigers any action. Is possibe to get button object whit getter and just trigered it from my user control?

Many thanks in advance.

# April 15, 2008 11:15 PM

mmaestro said:

The only thing which I would like to know is how to trigger from user control action to thickbox be shown? Could you help me please.

Many thanks in advance.

Kind regards.

# April 16, 2008 2:05 AM

Omar said:

hey..first Kudos on the great control :)...been looking for something like that for a while..Thank you :)

..but im having this problem..after importing your dlls to my website..some controls give me errors..like the Iframe for example:"Error Creating Control - ThickBoxIframe2  Uknown server tag"

..but the inlinecontent works fine..and the thickbox image too..

help please :)

Thanks again

# July 2, 2008 2:30 AM

kipo said:

I really like your control, but I have a problem with it. I'm not able to drag-n-drop the control into the design area and if I try to drag-n-drop it into the source view, I get the error "The operation could not be completed". I'm using Visual studio 2008.

Just to mention - if I type the control declaration manualy, control works perfectly.

# July 19, 2008 8:14 AM

Ruchir said:

Hi,

It is really good control and easy to implement. However  when I use this control in DotNetNuke module, I recieve the JavaScript error and it is because of the

"jquery-latest.pack.js". Is "jquery-latest.pack.js" is written in JQuery?

# July 31, 2008 6:27 AM

Muthukrishnan said:

Hi Erikl:

U given a wonderful tips to us for close thick box. thanks erikl.

Wonderful Done a job.

# August 23, 2008 2:48 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: