Solved

Gridview custom column

Posted on 2007-11-29
3
319 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 2

Author Comment

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

I got squiggly lined for something earlier.

thanks!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 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