Hello friends
i want to display the data from database on page which contains the text and image. The problem is that i want to arrange those like the text should be wrapped around the Image.
Can it is possible?

Please help me if you have idea about this.

Recommended Answers

All 7 Replies

yes it is. it's a css style called float. this will have a weird effect on your image as text will be really close to it. I would suggest using this as the style property:

style="padding-right:5px;padding-bottom:5px;float:left;"

that will keep the image on the left hand side with text wrapping around it. "float:right" will make it on the right hand side. If you want it on the right hand side, change padding-right to padding-left.

yes it is. it's a css style called float. this will have a weird effect on your image as text will be really close to it. I would suggest using this as the style property:

style="padding-right:5px;padding-bottom:5px;float:left;"

that will keep the image on the left hand side with text wrapping around it. "float:right" will make it on the right hand side. If you want it on the right hand side, change padding-right to padding-left.

hi
thanks again for reply me. as i mentioned earlier my text value and image are coming from database. To show them on aspx page i need control. i used Text area for text in a <td> and in next <td> image.
as you suggest me i assigned the style tag to text area and make both img and text area in same <td>. But not get the result as want.
Then i also tried by directly witting text value (from database) in a Div and Style as you said. But again i am not getting what i want. i.e text warped around image. and also when i used Div it is not showing the indentations inputed. So.... i am still failed and searching the solution. Can you do something in this !! :(

Thanks for reply again. :)

you do not need a control for database info, so you know. Is it going to be in a repeater, datalist, etc? If so, then you don't need any additional controls. If not, then keep in mind of the formatting of how the controls work. This should work fine for you:

<script ....>
Sub .....

ltlPicture.Text = "<img src=""" & databaseresult & """ style=""padding-right:8px;padding-bottom:8px;float:left;"" alt=""""" />"
ltlDescription.Text = databseoutput

End Sub
</script>

<html>
<body>
<asp:Literal ID="ltlPicture" runat="server" />
<asp:Literal ID="ltlDescription" runat="server" />
</body>
</html>

you do not need a control for database info, so you know. Is it going to be in a repeater, datalist, etc? If so, then you don't need any additional controls. If not, then keep in mind of the formatting of how the controls work. This should work fine for you:

<script ....>
Sub .....

ltlPicture.Text = "<img src=""" & databaseresult & """ style=""padding-right:8px;padding-bottom:8px;float:left;"" alt=""""" />"
ltlDescription.Text = databseoutput

End Sub
</script>

<html>
<body>
<asp:Literal ID="ltlPicture" runat="server" />
<asp:Literal ID="ltlDescription" runat="server" />
</body>
</html>

---------------------------------------------------------------------------------
Hi!
thanks for reply. you are right. by setting style tag i am getting the result text wrap around the image. thanks. But still not exact.
What i get is as in this pic......
What i want is as in this pic......
i think now what exactly i am searching is clear. Thanks.. Have a good day.
(if unable to open images then plz find the attached zip files.)
ZIP_IMG.zip

Okay, I need to see the code you are using, all HTML and Backend. The code I gave you should work, so it has to do with layout.

Hi,
GM.
Here is the HTML code.

<TR>
<td align="center">
<asp:Image id="imgTm" runat="server" width="200px" style="padding-right:8px;padding-bottom:8px;float:left;" ></asp:Image><TEXTAREA id="txtaTDtl" style="BORDER-RIGHT: gray 1px; BORDER-TOP: gray 1px; TEXT-JUSTIFY: newspaper; FONT-SIZE: 10pt; OVERFLOW: visible; BORDER-LEFT: gray 1px; TEXT-INDENT: 30pt; BORDER-BOTTOM: gray 1px; FONT-FAMILY: 'Century Gothic'; HEIGHT: 2000px; TEXT-ALIGN: justify" name="txtaTDtl" rows="51" cols="59" runat="server" readOnly wrap="hard"></TEXTAREA>
</TD>
</TR>
And nothing more than this.

That's why, you have everything going into a text area. Does it have to be in a text area? I mean, is it going to be edited? If it isn't, remove the text area and insert the text into the page :)

Something like this would work well:

<TR>
<td align="center">
<asp:Image id="imgTm" runat="server" width="200px" style="padding-right:8px;padding-bottom:8px;float:left;" /><asp:Literal ID="txtaTDtl" style="BORDER-RIGHT: gray 1px; BORDER-TOP: gray 1px; TEXT-JUSTIFY: newspaper; FONT-SIZE: 10pt; OVERFLOW: visible; BORDER-LEFT: gray 1px; TEXT-INDENT: 30pt; BORDER-BOTTOM: gray 1px; FONT-FAMILY: 'Century Gothic'; HEIGHT: 2000px; TEXT-ALIGN: justify" name="txtaTDtl" runat="server" wrap="hard" />
</TD>
</TR>

You have to refrain from the fields, and divs unless your image is inside the div. And if you look at the end of the tags, they end with "/>" which tells the server that the tag ends there. ending your tags with "/>" is the same as "></asp:Image>".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.