.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Where to find width of ImageButton after the image has been loaded?

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net

I have an ImageButton that loads different images (of differening sizes) based on a selection made by the user from a dynamic data list. This ImageButton is displayed beside the DetailView. I want to get the width of the DetailView (which is static) and the width of the ImageButton so I can set the width of the Div they are contained in to the sum of their width, plus a few px. Once I set the width of the DIV and I set and margins (left and right) are auto, the DetailView and ImageButton will be centered in the page. However, every way I've tried to get the ImageButton width, it is always zero. I've trying coding the ImageButton Load event and its PreRender event but I get zero in both cases. Do I need to check some other property, or another event, like maybe one from the form itself?


View Complete Post

More Related Resource Links

Image or ImageButton rounded corners


Hiiiii Coders,

I just want to make corners of my asp.net image or imagebutton rounded. How can i do so?  

Framework 4.0 dll loaded by a 2.0 executable cannot find "xxxx.resources.dll"

 Hello, I have an interesting situation here that I was hoping someone may be able to give some pointers on.  First my application is all provided within a class library assembly so that it can be loaded by multiple hosts.  We are investigating moving to Visual Studio 2010 and the .Net Framework 4.0 for some of the new features.  However, one of our hosts is a 2.0 click once application that we do not have the source to.  I've tried modifying the config file for the executable to add the useLegacyV2RuntimeActivationPolicy with the 4.0 as the supported runtime and setting loadFromRemoteSources as suggested by a Google search and that came close to working.  However, depending on the workflow through our client code is giving a System.IO.FileNotFoundException for various references. The message associated with the exception is Could not load file or assembly 'file:///XXXXXX.resources.dll' or one of its dependencies. The system cannot find the file specified."  Were the XXXXX changes and the .dll may or may not be present depending on whether Assembly.Load or Assembly.LoadFrom was used to perform the load.  Any thoughts would be greatly appreciated. [Addition: I forgot to mention that our app originally targeted Framework 3.5SP1] Michael Fischer

Upload image to database - couldn't find file path

I'm trying to display images in a GridView (yes, still this...). [edit] Before I can come to that I have to upload some images to the database.I've followed this tutorial for the "upload image to database" code (this worked fine for uploading images, but I don't know if the images were converted to byte):http://aspsnippets.com/Articles/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspxand I've followed this tutorial for the "display images in gridview" code (and "retrieve file" from the tutorial below).http://www.aspsnippets.com/Articles/Display-images-from-SQL-Server-Database-in-ASP.Net-GridView-control.aspxIt doesn't quite work, the GridView shows but without imagesNow I'm trying to change the "save file" code according to this tutorial:http://aspsnippets.com/Articles/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASP.Net.aspxbut I don't understand everything in it. When I try to upload an image I get an error on this line:FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); //couldn't find file (path to image I tried to upload) What should I do about it?

Change dimensions of image if width exceeds certain amount


(In a different post  I asked about how to access an Image control held in a FormView template. This topic has been mixed into it, so I thought I would start a fresh post only about this problem.)

I would like to perform a simple check to ascertain the width of an image. If it exceeds a certain dimension I would like to give the image a width property. I understand this doesn't not affect file size, just dimensions, but it is for presentation purposes. I'm still learning VB, but the code below is what I have tried so far:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim LargeImage As Image = DirectCast(FormView1.FindControl("Image1"), Image)

        Dim Width As Integer
        Width = LargeImage.Width.Value

        If Width > 560 Then
            LargeImage.Width = Unit.Pixel(560)
        End If

    End Sub


Thanks in advance,


Detect Width and Height of .jpg image



I have an image on this path that I first check if it exists. If it exists I wonder what the method is to get width and height of this image ?

            if (File.Exists(Server.MapPath("Images\\Pic1.JPG")))
		    //How to get the Width and Height of this JPG Image ?


Auto resize image width only


I have a question regarding the resizing of images.

My problem is that I would like to resize files that are being uploaded automatically. But I only want to resize the width.

Regarding the height of the file, this should auto adjust it self. Forexample; If I'm uploading a file that is 1000 px in width and 2000px in height and then resize it to 500px in width, then I want the height to be auto resized to 1000px. In other words the height and width has to be proportional. 

Could someone help me out on this. 

Thanks for reading. 

Trying to find out how data from warehouse is loaded into a dimension


(SQL Server 2005)

I have a customer data warehouse table that I am loading into a customer dimension.  Each row in the warehouse has a unique integer key.  It is possible to have multiple rows with the same customer name.  Each row will have an account code and an alternate account code.  Besides the key field, Name + Account + Alternate is what makes a row unique.

Once I process the table into the warehouse it looks like I am only getting one entry in the dimension based on customer name.  It is difficult to browse dimensions and tell exactly what is there.  I've tried setting up a plain demision and also adding  Account code and Alternate account codes as attribute relations under Name.  I've also tried a hierarchy with Name -> Account -> Alt Account.

I have a customer with 2 account codes and multiple Alternate codes - 29 rows in the warehouse.  When I browse I only get one result for name - I want to see 29 names all the same.  Do I need to set up the dimension somehow to use Name+Account+Alternate as the key?  Currently I am using the warehouse key field as the key. 



imagebutton shows "submit query" before image display


hi guys,

i have imagebutton's on a page with width/height's set and the imageurl pulls from a database

anyway theres 20'ish images on the same page so it takes a second or 2 for the images to load, unfortunately with the imagebutton, while it's in that limbo stage there's 20 big ugly grey SUBMIT QUERY textboxes in my face.


anyone know how to wkraround this? some sort of default already loaded image, or somehow to turn that off altogether? 

Displaying waiting image when page is loaded in asp.net



I want to display gif image when a page is loaded...

I have a dropdown list when this is selected Gridview is populated with data from database..

I want to show a gif image when this gridview is populated...

how to implement this without AJAX...





Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Configuring Profile Image Export in SharePoint 2010

It's no secret that I am thrilled with the new social features of SharePoint 2010. I am most excited about the new Profile Picture handling. I strongly believe that the more we can show the faces of our colleagues to one another the more connected we will feel. Clearly Microsoft feels that way as witnessed by the many features that make use of the Profile Image like the Activity Feed and Colleagues list

Built-in Functions - Text and Image Functions

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

ASP.Net Upload Image to MS Access Database

As you learnt from the previous articles to upload image to the SQL Database in ASP.Net 2.0 and stream that image into the memory to retrieve it from the database and display it on the web page. In this article you will learn how to upload images to the MS Access database in ASP.Net 2.0

First of all create an Access Database and place it in the App_Data folder of ASP.Net web site project. Then create a table "tblImg" with the following fields:

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

slideshow image gallary using jQuery



i need a gallary like following link.


actually,i bound multiple image in a gridview using handler(.ashx).

for example,in one dep_id(1),there are 6 image and i need to slideing one by one.

could some one help me,how i can do like this?

i think is it easy in jquery.

please someone help me.

Thanking you.

datalist image slide show problem


hi friends

i am binding  images dynamically(back end)for a datalist .iam applying a slideshow for it .I am getting a problem to apply slideshow for dyanmically binded images.If the define in a div statically it working perfectly

for example pls go through my code below:

<script type="text/javascript">
$(document).ready(function() {
        fx: 'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...

<div class="slideshow">
        <img src="images/30_dummy.jpg" width="200" height="200" />
        <img src="images/aquarius.gif" width="200" height="200" />
        <img src="images/star.gif" width="200" height="200" />
        <img src="images/the-proud-indian-flag-1.jpg" width="200" height="200" />

I above code works perfectly and the slide show e

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend