Solved

Gridview custom column

Posted on 2007-11-29
3
301 Views
Last Modified: 2012-08-14
In asp.net I am creating a gridview. All columns are from a table, except one. In this one column, it has a header and the column value is the same for every row. It is an image. The same image. On every row. Yep every row.

So how do I create a column that I can just put in the same image for every row?

I tried a TemplateField but the way I did it, it wouldn't let me add an <img tag or a or an <asp:Image runat="server"></asp:Image>.

I tried an ImageField from the properties, but that seemed to want to pull it from the database? <asp:ImageField

How do I do this?

thanks!
0
Comment
Question by:Starr Duskk
3 Comments
 
LVL 9

Accepted Solution

by:
bele04 earned 500 total points
ID: 20373984
A templatefield should do the trick, it would look something like this
<asp:GridView ID="GridView1" runat="server">

            <Columns>

                <asp:TemplateField HeaderText="78">

                    <ItemTemplate>

                        <asp:Image ID="Image1" runat="server" ImageUrl="your image link here" />

                    </ItemTemplate>

                </asp:TemplateField>

            </Columns>

        </asp:GridView>

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20373985
>>it wouldn't let me add an <img tag or a or an <asp:Image
runat="server"></asp:Image>

Why not?

Bob
0
 
LVL 1

Author Comment

by:Starr Duskk
ID: 20374338
Hmmm. I guess it does. <grin>

I got squiggly lined for something earlier.

thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A short film showing how OnPage and Connectwise integration works.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now