Solved

Gridview custom column

Posted on 2007-11-29
3
293 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:BobCSD
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:BobCSD
ID: 20374338
Hmmm. I guess it does. <grin>

I got squiggly lined for something earlier.

thanks!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 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

17 Experts available now in Live!

Get 1:1 Help Now