473,378 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Load Image from codebehind

HI Guys, I need to load image in table cell from codebehind.

i have the following code:

TableRow tRow = new TableRow();
Table2.Rows.Add(tRow);
TableCell tCell1= new TableCell();
if (property[4].Value.ToString()=="1")
{
tCell1.Image="test";
}

tRow.Cells.Add(tCell1);

Thanks in advance
Manny
Nov 18 '05 #1
2 9276
Hi.

System.Web.UI.WebControls.Image img = new Image();
img.ImageUrl = "/folder/blah_blah.gif";
img.Height = Unit.Pixels(20);
// Bunch of other "html like" properties are available for this type
//Or you can use img.Attributes collection to insert your own html/script
events attributes like this:
img.Attributes["onclick"] = "alert('Whatever');return false;";
//Then
tCell1.Controls.Add(img);
//End of story
Regards,
Kikoz
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:60**********************************@microsof t.com...
HI Guys, I need to load image in table cell from codebehind.

i have the following code:

TableRow tRow = new TableRow();
Table2.Rows.Add(tRow);
TableCell tCell1= new TableCell();
if (property[4].Value.ToString()=="1")
{
tCell1.Image="test";
}

tRow.Cells.Add(tCell1);

Thanks in advance
Manny

Nov 18 '05 #2
Thank you. Will give this a try.

"Kikoz" wrote:
Hi.

System.Web.UI.WebControls.Image img = new Image();
img.ImageUrl = "/folder/blah_blah.gif";
img.Height = Unit.Pixels(20);
// Bunch of other "html like" properties are available for this type
//Or you can use img.Attributes collection to insert your own html/script
events attributes like this:
img.Attributes["onclick"] = "alert('Whatever');return false;";
//Then
tCell1.Controls.Add(img);
//End of story
Regards,
Kikoz
"Manny Chohan" <Ma*********@discussions.microsoft.com> wrote in message
news:60**********************************@microsof t.com...
HI Guys, I need to load image in table cell from codebehind.

i have the following code:

TableRow tRow = new TableRow();
Table2.Rows.Add(tRow);
TableCell tCell1= new TableCell();
if (property[4].Value.ToString()=="1")
{
tCell1.Image="test";
}

tRow.Cells.Add(tCell1);

Thanks in advance
Manny


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following...
2
by: Christopher Ambler | last post by:
I'm wondering if there's a solution here - I have an ASPX page with a sole purpose of scaling an image. The ASPX page contains a single line with the codebehind tag, and the .cs file contains...
1
by: David Johnson | last post by:
Okay, creating an ASP.NET application with Visual Studio on a remote server (not local machine). It starts up with WebForm.aspx I put an image in webform.aspx, save it, and jump over to...
3
by: Simon Harris | last post by:
Hi All, I have a data grid which displays country names. I now wish to display the country flag images above the names. Can someone please advise how I display an image in a datagrid? I have a...
4
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the...
4
by: simon | last post by:
have an image (acting like a button) currently that has onMouseOver and onMouseOut events. want to make this accessible to the codebehind with a click event. was able to right click at and choose...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.