473,405 Members | 2,354 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,405 software developers and data experts.

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="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

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

Sub Page_Load(Sender as Object, E as EventArgs)

Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapter
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet

'Build the connection string
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
sConn += "Data Source=D:\inetpub\www\mysite\myaccessdb.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 OleDbDataAdapter(sComm, oConn)

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

'Set the grid source to the dataset and bind the data
oGrid.DataSource=oDataSet.Tables("qryDataGrid01"). DefaultView
oGrid.DataBind()

End Sub
</script>
<asp:DataGrid runat="server" id="oGrid" BackColor="#eeeeee"
HorizontalAlign="Left">
<HeaderStyle Font-Bold="True"/>
<AlternatingItemStyle BackColor="White" />
</asp:datagrid>

Feb 18 '08 #1
3 985
"Jonathan" <no**@none.comwrote 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:\inetpub\www\mysite\myaccessdb.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.comwrote:
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="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

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

Sub Page_Load(Sender as Object, E as EventArgs)

Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapter
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet

'Build the connection string
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
sConn += "Data Source=D:\inetpub\www\mysite\myaccessdb.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 OleDbDataAdapter(sComm, oConn)

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

'Set the grid source to the dataset and bind the data
oGrid.DataSource=oDataSet.Tables("qryDataGrid01"). DefaultView
oGrid.DataBind()

End Sub
</script>

<asp:DataGrid runat="server" id="oGrid" BackColor="#eeeeee"
HorizontalAlign="Left">
<HeaderStyle Font-Bold="True"/>
<AlternatingItemStyle BackColor="White" />
</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.comwrote:
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="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

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

Sub Page_Load(Sender as Object, E as EventArgs)

Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapter
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet

'Build the connection string
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
sConn += "Data Source=D:\inetpub\www\mysite\myaccessdb.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 OleDbDataAdapter(sComm, oConn)

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

'Set the grid source to the dataset and bind the data
oGrid.DataSource=oDataSet.Tables("qryDataGrid01"). DefaultView
oGrid.DataBind()

End Sub
</script>

<asp:DataGrid runat="server" id="oGrid" BackColor="#eeeeee"
HorizontalAlign="Left">
<HeaderStyle Font-Bold="True"/>
<AlternatingItemStyle BackColor="White" />
</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
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,...
1
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,...
0
by: newbie | last post by:
Hi Can anyone please tell me how I can get and decompress JPEGs from an URL? Thank you!
12
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...
1
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...
0
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...
1
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...
2
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...
4
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...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.