Smile

Smile

  • 1.4k
  • 197
  • 33.6k

Image to fit in asp page

Jan 17 2018 7:08 AM
I am displaying image from a folder using an asp image control in a timer.The image doest not correctly fit into the screen like it gets vertical and hortizontal scroll bars.
 
 
aspx code
 
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="BannerPanel" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="5000" Enabled="false" >
</asp:Timer>
<asp:Button ID="btnDisplay" runat="server" Text="Display " OnClick="btnDisplay_Click" />
<asp:Image ID="Image1" runat="server" style="width: 100%;" />
</ContentTemplate>
</asp:UpdatePanel>
 
 
code behind
 
string localstr = Server.MapPath("~//bin//Images//"+ Filename );
Byte[] bytes = File.ReadAllBytes(localstr);
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
Image1.ImageUrl = "data:image/" + ext + ";base64," + base64String;
 
 

Answers (4)