473,789 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding image from code behind

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

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCel l id="tc1" Runat="server"> &nbsp;</asp:TableCell>
<asp:TableCel l 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 8801
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********@hot mail.com> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCel l id="tc1" Runat="server"> &nbsp;</asp:TableCell>
<asp:TableCel l 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.co m> wrote in message
news:eI******** ******@TK2MSFTN GP15.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********@hot mail.com> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCel l id="tc1" Runat="server"> &nbsp;</asp:TableCell>
<asp:TableCel l 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********@hot mail.com> wrote in message
news:u6******** ******@TK2MSFTN GP14.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.co m> wrote in message
news:eI******** ******@TK2MSFTN GP15.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********@hot mail.com> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
Hi.
I have an asp:table, like this:

<asp:Table runat="server" id="Table1">
<asp:TableRow Runat="server">
<asp:TableCel l id="tc1" Runat="server"> &nbsp;</asp:TableCell>
<asp:TableCel l 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
11099
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
5
2194
by: Haydnw | last post by:
Hi, I have the code below as code-behind for a page which displays two images. My problem is with the second bit of code, commented as " 'Portfolio image section". Basically, the SQL query gets details of a random image from an access database. I know this works because when I run the query in access, it picks a different image each time (or close enough). However, when I view the .aspx page that this code-behind is for, it always picks...
6
22133
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically I want to know how can I have the mousedown and mouseup buttons events. I think that I have to do this in JavaScript. Can you help me on this?
0
1216
by: Rick | last post by:
I have a panel that I have set up to look like a command button with Text and an image. I would like to have an onclick event that runs code in the code behind page, not on the client. It is possible to add the onclick event to run a procedure in the code behind page? Thanks, Rick
13
2359
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't reached yet (I have gone all the way to page 50 on Google's results!!). Here are my requirements: • I have a DataGrid. Everything will be done from here. Everything. No exceptions. Everything will also be done in VB, without any code-behind to...
18
7444
by: Andrew Christiansen | last post by:
Hey all. The images I create in photoshop with semi-transparent pixels (for instance in Photoshop text with a dropshadow with a transparent canvas) I've been saving in PNG format and then using them in my VB.NET app using the picturebox control. I was really happy when I learned that you could use PNG images in VB.NET so your images could blend in with the form's background color. But, is PNG the ideal image format to use with these...
9
2299
by: Rajesh | last post by:
Hi all, Im gonna display a list of images in an aspx page from sql server Db.Each image has a link.When someone clicks the image i want the width and size of the image to be displayed at the bottom of the image without any coding at code-behind because the resulting page will display only the image. Rajesh
0
1795
sketchgrrl
by: sketchgrrl | last post by:
I'm using IE to build a GoDaddy.com Website Tonight site. I want to add a background image (probably a repeating one to make sure it covers all the empty spaces behind the images on the page already). I found some CSS and also HTML code online but when I tried those, they didn't work. Into those codes, I had inserted the name of the jpg image I had uploaded into my site's Website Tonight library (the image I want to use as the page's...
4
4123
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats Sleeping"; //Create Image Image img = new Image();
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.