468,251 Members | 1,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,251 developers. It's quick & easy.

Adding image from code behind

Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCell id="tc1" Runat="server">&nbsp;</asp:TableCell>
<asp:TableCell id="tc2" Runat="server">&nbsp;</asp:TableCell>
</asp:TableRow>
</asp:Table>

How can I add a background image to the TableCells from code behind?

Thanks,
Shawn
Nov 19 '05 #1
3 8564
Shawn,

Make a css style with atribute background-image set to your image. Set
CssClass property for TableCell into the style name.

Eliyahu

"Shawn" <bo********@hotmail.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCell id="tc1" Runat="server">&nbsp;</asp:TableCell>
<asp:TableCell id="tc2" Runat="server">&nbsp;</asp:TableCell>
</asp:TableRow>
</asp:Table>

How can I add a background image to the TableCells from code behind?

Thanks,
Shawn

Nov 19 '05 #2
Thanks for quick answer!

The thing is that the background image is an embedded resource so I don't
think I can't use that method.
Do you know of another way?

Thanks,
Shawn

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Shawn,

Make a css style with atribute background-image set to your image. Set
CssClass property for TableCell into the style name.

Eliyahu

"Shawn" <bo********@hotmail.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCell id="tc1" Runat="server">&nbsp;</asp:TableCell>
<asp:TableCell id="tc2" Runat="server">&nbsp;</asp:TableCell>
</asp:TableRow>
</asp:Table>

How can I add a background image to the TableCells from code behind?

Thanks,
Shawn


Nov 19 '05 #3
One second. Whatever place your image is in on the server, the client can
get it only by url. So you have to provide the client with the url to the
image. It doesn't mean you have to export the image in a separate file. You
can make a page that will accept an image id as a parameter, get the image
from the resource and then stream it down to the client, in the way how
database-stored images get sent to clients. But as far as table cell setting
is concerned, you should do it in the way I suggested. The css rule can look
like

background-image : "getImage.aspx?id=1";

Eliyahu

"Shawn" <bo********@hotmail.com> wrote in message
news:u6**************@TK2MSFTNGP14.phx.gbl...
Thanks for quick answer!

The thing is that the background image is an embedded resource so I don't
think I can't use that method.
Do you know of another way?

Thanks,
Shawn

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Shawn,

Make a css style with atribute background-image set to your image. Set
CssClass property for TableCell into the style name.

Eliyahu

"Shawn" <bo********@hotmail.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCell id="tc1" Runat="server">&nbsp;</asp:TableCell>
<asp:TableCell id="tc2" Runat="server">&nbsp;</asp:TableCell>
</asp:TableRow>
</asp:Table>

How can I add a background image to the TableCells from code behind?

Thanks,
Shawn



Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by D. Alvarado | last post: by
6 posts views Thread by ruca | last post: by
reply views Thread by Rick | last post: by
18 posts views Thread by Andrew Christiansen | last post: by
9 posts views Thread by Rajesh | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.