Solved

Gridview custom column

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Message not shown 5 52
Error handling in asp.net site 5 29
Client Validating 2 date fields, required & comparison 1 29
Iteration Help (Asp.net VB) 5 11
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 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