.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

handle image inside div tag

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

is there any way to fit the image size @ div size.

i mean my image is little bigger or little lower in size than div size or assume i have a div which has not hight and width attribute then how do i handle image inside div. i think it is not possible to handle when div has no h&w attributes and in this case image will come with its own h&w.

but if have defined the h&w for any div tag then there should be some way to manage little size differences.

or reply me if you have a good way to manage size consistency.


View Complete Post

More Related Resource Links

image inside custom server control



I want to use an image inside a Custom Web server control ! 

Do I need to use Web.resources ? if so , how to do ?

Image stretch inside a grid stops working horizontally once columns are added to grid.

I have a simple setup of a window. Window contains a grid, inside the grid there is an image. I want the image to always stretch across the entire cell. I've set it's Stretch property to Fill and it works fine, as long there is only one column in the parent grid. As the window is resized, the image stretches correctly. As soon as I add another column, the image stops stretching horizontally. Vertially it works just like before, horizontally it now appears with a fixed width corresponding to the width of the picture used as the source. Does not matter which column it's positioned in, and I've tried encapsulating it into another grid but behaviour does not change. It behaves the same in both Visual studio 2010 designer and at runtime. In addition when I tried to encapsulate it in a second grid, this seond grid also now has altered behavior - instead of sizing itself to it's container (both height and width are not set) as it's parent grid does, it now sizes itself to its contents - the image. But only horizontally. What is going wrong here, is this a bug or am I missing something, and any advice on how I can get the image to fill one of the cells of a grid with more then one column?

Alert not working when used with image inside gridview

I am currently using following code to set alert on required column of my grid. When I change button type to Image the alert appear after completion action. Any quick suggestion??   My code is below.. protected void grdDelTempList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[6].Attributes.Add("onClick", "javascript:return confirm('Are You Sure?');"); } }    

ImageList and a system image list handle

How can I have an ImageList use an image list handle of a systems image list, such as one that can be returned from SHGetFileInfo ? My image list is associated with a ListView control and this could be easily done in Win32 through the LVM_SETIMAGELIST message with an image list handle but I see no easy way of doing this with the .Net System.Windows.Forms.ImageList component.
shows extra lines around the image   

I am working with two different 'rounded corner' images and I am getting an extra line at the top of the smaller image.  The first image, headerborder_corner_tl_3.png, is 25 x 25.  This image diplays correctly in the first <div> below. 

The second image, pageborder_corner_tl_4.png, is 15 x 15.  In the second <div> below, the image gets displayed with an extra line at the top of the image.  But if I comment out the second <td>  (as I do in the third <div>) the image displays correctly.

Looking at the second div, can someone shed some light on what might be causing the image to be displayed with an extra line above it...or why it displays correctly when I comment out the second <td>?

        <table bgcolor="#F6AD2C" cellpadding="0" cellspacing="0" align="center">
                <td width="25" height="25">
                    <img src="<%= Page.ResolveUrl("~&q

Problem with Editing image inside DetailsView inside UpdatePanel



I have a problem and I really hope you'll be able to help me.

I'm trying to add and edit an image which is located in a detailsview which is inside an UpdatePanel. After I read relevant topics in the forum I installed the Ajax Control Toolkit. Below is my source code. When I used it only for insert new image it worked great. The problem caused when I tried to implement it on the Edit mode, i.e. when I tried to edit the image and upload a different image.  Unfortunately it didn't work as I hoped. Nothing happend and the image hasn't been changed. I also tried to change the IDs (AsyncFileUpload ID) to be the same in both places but it didn't work either.

The source code:

<asp:DetailsView ID="dvMovie" runat="server" Height="50px" Width="695px"
                    AutoGenerateRows="False" DataSourceID="sdsMovieById"      
                     BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"

Image tag rendering inside repeator


i have a repeator control that is bind to a dataset, one of the field is image path that is bind with <img src tag. Now the problem is so of the articles are with out any image, how can i make sure that <img tag only render when there is an image name exist?

   <asp:Repeater runat="server" ID="rptCollections">
                <br />
                        <img style="margin-right: 10PX; width: 200PX; float: left;" src="<%#Eval("MainImage ").ToString()%>" /><%#Eval("Summary").ToString()%></p>--%>
        <asp:Repeater runat="server" ID="rptContent">
                <table border="0" cellpadding="0">

ASP Image inside UpdatePanel changing ImageUrl



I have a WebForm which has an update panel. Inside the panel I have an ASP Image. I have also, 2 ImageButtons which act as the triggers for the UpdatePanel.

<asp:UpdatePanel ID="updImage" runat="server">
          <asp:AsyncPostBackTrigger ControlID="btnBackward" EventName="Click" />
          <asp:AsyncPostBackTrigger ControlID="btnForward" EventName="Click" />
          <asp:Image ID="Image1" runat="server" Width="75px" Height="75px" BorderStyle="Solid" BorderWidth="5px" BorderColor="White" />

In my WebForm, I also have an ASP Image component outside the Update panel.

The ImageUrl of those ASP Image components are loaded from a folder that is outside the WebSite root folder, using the code found in this link:


Radio buttons, a label and an image button show twice inside update panel


I have an update panel with a set of 2 radio buttons, a label and an image button inside of it. There another set of 3 radio buttons that trigger the update panel. I got everything working but now the image button, label and set of 2 radio buttons inside the update panel show up twice when the radio button triggers are selected? Any ideas?

Image Inside a webpart


Hi All Gurus

I am trying to create a webpart in which I have 15-20 images & I want the images to change as per the month & season. the images are static they will never change.

Can someone pls suggest me the best way to achive this. I am looking for a solution from scratch.

My Approach (I am thinking but open to your inputs) is;

1) Create a User ctrl & place a Image control on it.
Here what will be my URL to make the webpart look at ~layout/image/New Foldername/Image.Imageextn (If some one can give me a code snippet of this will be a great help. I will surely vote :)

But with the above appraoch I am thinking where to store my images physically other than Layouts, also this will be deployed to multi WFEs

Also, if I want to use the layouts folder, what will be my DDF file command to create the folder in ~layout/image/New Foldername/Image.Imageextn

Thanks in advance Vote assured
Happy Sharepointing.

I am a learner So your help will help me build


Happy Sharepointing... Regards SPTECH07

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

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.
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