SIGN UP MEMBER LOGIN:    
ARTICLE

Image rotation in ASP.Net

Posted by Dinkar Chavhan Articles | ASP.NET Controls in C# April 12, 2011
Learn how to perform image rotation in ASP.Net.
Reader Level:

This code for image rotation is simple so we will start step by step.

Step 1) Take an image and button control; code like:

{
<form id="form1" runat="server">
     <div>
   
         <asp:Image ID="Image1" runat="server" Height="178px" Width="247px
ImageUrl="~/images/2168NN97_4[1].jpg" />
   
     </div>
     <asp:Button ID="Button1" runat="server" Text="&gt;&gt;" 
         OnClick="Button1_Click"/>
}
 

Step 2) Double-click on the button and write code as follows:

{
protected void Button1_Click(object sender, EventArgs e)
      {
        string p = Server.MapPath(Image1.ImageUrl);
        System.Drawing.Image i = System.Drawing.Image.FromFile(p);
        i.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipX);
        i.Save(p);
        i.Dispose();
        Image1.Attributes.Add("ImageUrl",p);
      }
}

Step 3)

Now execute the application and verify that it runs as expected.

erver'>
Login to add your contents and source code to this article
share this article :
post comment
 

Thanks

Posted by Dinkar Chavhan Apr 14, 2011

nice one...

Posted by Dinesh Beniwal Apr 14, 2011
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor