473,795 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid - include jpegs

In one of the 4 output columns of my Datagrid, I have a Yes/No Boolean
field.

I'd like to show a graphical tick (e.g. tick.jpg) or a cross e.g.
(cross.jpg) instead of True/False or Yes/No.

How could I do that? Here's the code:
</head>

<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<script language="VB" runat="server">

Sub Page_Load(Sende r as Object, E as EventArgs)

Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapte r
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet

'Build the connection string
sConn = "Provider=Micro soft.Jet.OLEDB. 4.0;"
sConn += "Data Source=D:\inetp ub\www\mysite\m yaccessdb.mdb;"
sConn += "Persist Security Info=False"

'Build the SQL string
sComm = "SELECT qryDataGrid01.* "
sComm += "FROM qryDataGrid01;"

'Create the connection and command objects
oConn = New OleDbConnection (sConn)
oComm = New OleDbDataAdapte r(sComm, oConn)

'Fill the dataset with the results of the query
oComm.Fill(oDat aSet, "qryDataGrid01" )

'Set the grid source to the dataset and bind the data
oGrid.DataSourc e=oDataSet.Tabl es("qryDataGrid 01").DefaultVie w
oGrid.DataBind( )

End Sub
</script>
<asp:DataGrid runat="server" id="oGrid" BackColor="#eee eee"
HorizontalAlign ="Left">
<HeaderStyle Font-Bold="True"/>
<AlternatingIte mStyle BackColor="Whit e" />
</asp:datagrid>

Feb 18 '08 #1
3 998
"Jonathan" <no**@none.comw rote in message news:fp******** **@aioe.org...
In one of the 4 output columns of my Datagrid,
DataGrid? Are you still using Visual Studio.NET 2003...?
I'd like to show a graphical tick (e.g. tick.jpg) or a cross e.g.
(cross.jpg) instead of True/False or Yes/No.
http://authors.aspalliance.com/aspxt...odatagrid.aspx
sConn += "Data Source=D:\inetp ub\www\mysite\m yaccessdb.mdb;"
Surely not...? The above implies that your database is in your website's
virtual root, meaning that it is fully accessible through a browser:

http://www.mysite.com/myaccessdb.mdb
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 18 '08 #2
On Feb 18, 4:31 pm, "Jonathan" <n...@none.comw rote:
In one of the 4 output columns of my Datagrid, I have a Yes/No Boolean
field.

I'd like to show a graphical tick (e.g. tick.jpg) or a cross e.g.
(cross.jpg) instead of True/False or Yes/No.

How could I do that? Here's the code:

</head>

<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<script language="VB" runat="server">

Sub Page_Load(Sende r as Object, E as EventArgs)

Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapte r
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet

'Build the connection string
sConn = "Provider=Micro soft.Jet.OLEDB. 4.0;"
sConn += "Data Source=D:\inetp ub\www\mysite\m yaccessdb.mdb;"
sConn += "Persist Security Info=False"

'Build the SQL string
sComm = "SELECT qryDataGrid01.* "
sComm += "FROM qryDataGrid01;"

'Create the connection and command objects
oConn = New OleDbConnection (sConn)
oComm = New OleDbDataAdapte r(sComm, oConn)

'Fill the dataset with the results of the query
oComm.Fill(oDat aSet, "qryDataGrid01" )

'Set the grid source to the dataset and bind the data
oGrid.DataSourc e=oDataSet.Tabl es("qryDataGrid 01").DefaultVie w
oGrid.DataBind( )

End Sub
</script>

<asp:DataGrid runat="server" id="oGrid" BackColor="#eee eee"
HorizontalAlign ="Left">
<HeaderStyle Font-Bold="True"/>
<AlternatingIte mStyle BackColor="Whit e" />
</asp:datagrid>
Hi...

You can change your column's item template and add a image in item
template...
next in item data bound depenting on your data value change source of
the image...

please take a look at this section...
http://www.asp.net/learn/data-access/#formatting

Thanks
Md. Masudur Rahman
www.munna.shatkotha.com
www.kaz.com.bd
Feb 18 '08 #3
On Feb 18, 5:31 am, "Jonathan" <n...@none.comw rote:
In one of the 4 output columns of my Datagrid, I have a Yes/No Boolean
field.

I'd like to show a graphical tick (e.g. tick.jpg) or a cross e.g.
(cross.jpg) instead of True/False or Yes/No.

How could I do that? Here's the code:

</head>

<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<script language="VB" runat="server">

Sub Page_Load(Sende r as Object, E as EventArgs)

Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapte r
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet

'Build the connection string
sConn = "Provider=Micro soft.Jet.OLEDB. 4.0;"
sConn += "Data Source=D:\inetp ub\www\mysite\m yaccessdb.mdb;"
sConn += "Persist Security Info=False"

'Build the SQL string
sComm = "SELECT qryDataGrid01.* "
sComm += "FROM qryDataGrid01;"

'Create the connection and command objects
oConn = New OleDbConnection (sConn)
oComm = New OleDbDataAdapte r(sComm, oConn)

'Fill the dataset with the results of the query
oComm.Fill(oDat aSet, "qryDataGrid01" )

'Set the grid source to the dataset and bind the data
oGrid.DataSourc e=oDataSet.Tabl es("qryDataGrid 01").DefaultVie w
oGrid.DataBind( )

End Sub
</script>

<asp:DataGrid runat="server" id="oGrid" BackColor="#eee eee"
HorizontalAlign ="Left">
<HeaderStyle Font-Bold="True"/>
<AlternatingIte mStyle BackColor="Whit e" />
</asp:datagrid>
If you *can* use ASP.NET 2.0, you can use the ImageField property of
GridView. An example is available here:

http://authors.aspalliance.com/aspxt...Field.aspx.src

Also, as Mark has pointed out, your database is located in your web
folder and can be directly downloaded, which needs to be fixed.
Feb 18 '08 #4

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

Similar topics

3
3430
by: Aaron Davies | last post by:
I'm trying to write some classes for my collaborative whiteboard to transmit images over the network, using the javax.imageio API, but I'm running into an odd problem: my code words fine with PNGs, but not with JPEGs. As you can see below, I've attached a progress listener to the reader, which reports progress up to just under 95%, then nothing. The warning listener reports no warnings. The images are written by an ImageWriter in another...
1
1639
by: Vagabond Software | last post by:
I am creating a custom datagrid based, in part, from someone else's code. The author declared a derived datagrid class in a windows form, then declared a derived ColumnStyle class, in the same form, that accepted his custom grid type as an argument. For example: public class HisCustomGrid : DataGrid { public HisCustomGrid() { } } public class HisColumnStyle : DataGridTextBox { public HisColumnStyle(int anyint, HisCustomGrid grid) { } }...
0
966
by: newbie | last post by:
Hi Can anyone please tell me how I can get and decompress JPEGs from an URL? Thank you!
12
2882
by: James Norton-Jones | last post by:
Hi, Am I trying to hold the data of a DataGrid in a label so that when the form is reposted the DataGrid can be repopulated. The problem I am having is that I don't understand how to get the text into a stream in order to be able to use DataSetOutcomes1.ReadXML(MyStream). Thanks in advance, James
1
1866
by: Dexter | last post by:
Hello all, I have a datagrid with "create columns automatically at run time" checked, and this datagrid show dynamic tables, then the column numbers is dynamic. I need to include a template column at end of datagrid. I have all code, but the template column is add always at column number 0.
0
1639
by: cwbp17 | last post by:
I'm having trouble updating individual datagrid cells. Have two tables car_master (columns include Car_ID, YEAR,VEHICLE) and car_detail (columns include Car_ID,PRICE,MILEAGE,and BODY);both tables have a FK relationship on CAR_ID so the oracledataadapter1 select statement(CommandText) is: select car_master.car_id, car_master.year,car_master.vehicle,car_detail.car_id AS EXPR1,
1
1086
by: kmazur | last post by:
Hello, I have a folder on the server g:\users\logos\. I need to create a web app that will display all the images in that folder (there are gifs, tiffs, jpegs and bmps) in thumbnail format and then when the user clicks, he/she can download that image. I found some sample code that will display one type of image (jpgs) but I cannot figure out how to display all different formats. IS there any sample code out there? any help will be...
2
1703
by: tlc1680 | last post by:
I am trying to add jpegs in a form, I am using a bound object Frame. When I right click and insert object I choose create from file I choose the picture and all that shows up is a link, the only way I have gotten the picture to show up is if I use a .gif and instead of a .jpeg. When I click create new, I am unable to get any of my options to work. On a personal computer I was able to use Microsoft Photo Editor 3.0 and have it insert a...
4
5547
by: =?Utf-8?B?ZG1idXNv?= | last post by:
I have an Access database with a table named 'tblMedia'. In tblMedia I have a field named 'Media' that is defined as an 'OLE Ojbect' field. In this Media field, I have pictures, they are jpegs. I'm using VB.NET 2005 and I would like to open the Access database and write the OLE Objects to the file system. Here's what I got and it's not working. 'Open connection to the Access database OpenConnection()
0
9673
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
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10167
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
10003
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
5440
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
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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
3
2922
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.