473,757 Members | 10,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a Template Column with an Image in a datagrid?

Hello,

How to create a Template Column with an Image in a datagrid from my VB
code?

Thanks,
Miguel

Nov 19 '05 #1
1 1296
Hi,
First you need to create a TemplateColumn and add it to the datagrid.
Dim tmpCol As TemplateColumn
tmpCol = New TemplateColumn
DataGrid1.Colum ns.Add(tmpCol)

Then on the DataGrids itemBound event you have to add an image to the cell.
Private Sub DataGrid1_ItemD ataBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
DataGrid1.ItemD ataBound
Dim imgTemp As New System.Web.UI.H tmlControls.Htm lImage
imgTemp.Src = "..."(Path of the image)
e.Item.Cells(0) .Controls.Add(i mgTemp)
End Sub
PS:I have given a simplest way of getting an image column in a datagrid.
--
HTH
srini
http://www.expertszone.com
"Shapper" wrote:
Hello,

How to create a Template Column with an Image in a datagrid from my VB
code?

Thanks,
Miguel

Nov 19 '05 #2

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

Similar topics

2
4553
by: Nicole | last post by:
I am creating template columns programmatically. I have read the msdn article on this and I'm so close. Article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchcreatingwebservercontroltemplatesprogrammatically.asp I have narrowed down the problem comes in when the _DataBinding handler is called and the literal text is being assigned, but I can't figure out beyond that. The main problem is that...
0
1768
by: Jim Hammond | last post by:
The code below implements two datagrid columns that display images. The first column is just a test that always displays the same image directly from a file. The second column pulls the image from the dataset. The datagrid contains several additional columns that are not seen here because they are automatically generated and bound to the dataset. All columns work except the second image column, which attempts to bind to the dataset. When...
0
1128
by: Michelle Stone | last post by:
i am puzzled. i have previously bound datasets to datagrids which contain the filename of IMAGES. And i use template columns to show the image for each row. But now it is not working. I have reviewed the code for over two days and I am still stuck. Here is the template column as it is in the datagrid now <asp:TemplateColumn HeaderText="Status"><ItemTemplate><asp:Image id=Image4 runat="server" ImageUrl='<%# gridGetImagePath...
1
1307
by: William Gower | last post by:
I need to develop a datagrid that uses columns from a table. In addition I need two columns (checkboxes) that the user will use to indicate that this record can be closed later. The checkboxed column is not a field in the table. It is just for the purposes of the Datagrid and I do not need to store whether it was checked or not. Do I use a Template Column for this?
1
2287
by: RJN | last post by:
Hi I have a few template columns in my grid and each has a header template. Within the header template I have got 2 controls, one is a link button and other image. There is a sort command on each of the header columns and an image which shows whether descending or ascending. <asp:TemplateColumn HeaderText="Name"> <HeaderTemplate> <asp:LinkButton ID="link1" CommandArgument="id" CommandName="Sort"
1
1495
by: RN | last post by:
Hi. I used this article to add a template column to a datagrid that is entirely created with code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingtemplatesprogrammaticallyindatagridcontrol.asp It works fine except for one thing. My template column needs a field in the recordset that binds to the datagrid. The template column is an HTML radio button where the value of the radio button needs...
1
1697
by: Miguel Dias Moura | last post by:
Hello, I have a dataset with 2 fields, (String) and (Boolean). I want to add, FROM the ASPX.VB Code, 2 columns: 1. Column which will display the Text field. I need this column to recognize HTML tags. The field might be something like "<h1>Heading</h1><p>Paragraph</p>
2
10405
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat actually happens is... when the Text size is too big... the column
0
1462
by: dotnet dude | last post by:
I am creating a DataGrid control (ASP.NET 1.) with few bound columns and one template column in which i want to display CheckBox. So for each row in datagrid some databound fields and a checkbox column. When a checkbox is selected, it indicates that particular row is selected. The checkbox selection I want to do is through javascript to improve the performance of the application. How do I design such datagrid which allows me to do...
0
9489
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
10072
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...
0
9906
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
9885
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
9737
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
8737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7286
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2698
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.