Using colorbox component in your ASP.NET Application

You need to first download the colorbox.js file from the link given below.

http://www.jacklmoore.com/colorbox

Get the JS file and colorbox.css file which will be useful when you want to open any popup(jQuery dialog).

So at first you need to import css file and js file into your project.
Similar like this

Import File

Create an anchor tag and give any class to them. (Remember class must be the unique.) and in href option you can write link where you want to redirect. Here i need to use the imagebutton so i am combining anchor tag and imagebutton

Sample Anchor Tag

that’s it completed from the Designing page now you need to do changes in jQuery to open the popup.

You need to add the jQuery as described follow

Sample Code

That’s it You have completed with that and you can now open the jQuery dialog with this.

To close the dialog and reload current page you need to write the code in GoToLink.aspx Page
parent.document.location = parent.document.location;
parent.$.fn.colorbox.close();

or you can simply press escape this will close the popup.

You can get more details on the following link.
http://www.jacklmoore.com/colorbox

Leave a comment