ASP.NET 4.5 and ASP.NET Core 1 Hosting BLOG

Tutorial and Articles about ASP.NET 4.0 and the latest ASP.NET 4.5 Hosting

ASP.NET Core 1.0 Hosting - ASPHostPortal.com :: How to integrate those fancy modal image preview in ASP.NET

clock June 27, 2016 20:51 by author Dan

Today, in this post I will quickly show you " How to integrate those fancy modal image preview in ASP.NET ".
Magic library for this functionality is mighty FancyBox the "tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages. It is built at the top of the popular JavaScript framework jQuery and is both easy to implement and a snap to customize."

Let's see how things are working....

  1. We create web site project inside our VS 2012.
  2. Include into project jQuery in this sample I use latest version 1.7.2.
  3. Also we need to include FancyBox. (It would be very strange to not include it in this sample)

So, our project look's like:

Here you can see our included files inside project, also you can see our test page html and jQuery code.
Most important thing here is that you use class="fancybox" as image control css class.

jQuery code is very very simple as you can see here:

       $(document).ready(function () {
            $(".fancybox").fancybox();
        });


There are more cases in how to use fancybox that you can check at FancyBox.

Effect that we managed to create looks like this:

When we click on image we get this.

So, long, folks!

Best ASP.NET Core 1.0 Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASP.NET 4.0 Hosting - ASPHostPortal.com :: Initialize assemblies using PreApplicationStartMethod for ASP.NET 4.0 Application

clock December 20, 2013 05:44 by author Robert

Sometimes your ASP.NET application needs to hook up some code before even the Application is started. Assemblies supports a custom attribute called PreApplicationStartMethod which can be applied to any assembly that should be loaded to your ASP.NET application, and the ASP.NET engine will call the method you specify within it before actually running any of code defined in the application.

Lets discuss how to use it using Steps :

1. Add an assembly to an application and add this custom attribute to the AssemblyInfo.cs. Remember, the method you speicify for initialize should be public static void method without any argument. Lets define a method Initialize. You need to write :

[assembly:PreApplicationStartMethod(typeof(MyInitializer.InitializeType), "InitializeApp")]

2. After you define this to an assembly you need to add some code inside InitializeType.InitializeApp method within the assembly.

public static class InitializeType
{
    public static void InitializeApp()
    {
          // Initialize application
    }

}

3. You must reference this class library so that when the application starts and ASP.NET starts loading the dependent assemblies, it will call the method InitializeApp automatically.

Warning

Even though you can use this attribute easily, you should be aware that you can define these kind of method in all of your assemblies that you reference, but there is no guarantee in what order each of the method to be called. Hence it is recommended to define this method to be isolated and without side effect of other dependent assemblies.

The method InitializeApp will be called way before the Application_start event or even before the App_code is compiled.

This attribute is mainly used to write code for registering assemblies or build providers.

 



Cheap ASP.NET 4.5 Hosting

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions


Author Link


 

Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Tag cloud

Sign in