473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Create GridView Column

Hello,

I have a dataset with 2 fields, [Text](String) and [Approved](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 [Text] field might be something like
"<h1>Heading</h1><p>Paragraph</p>

2. Column which will display an image:
It will display "Verified.gif" if Approved is True.
It will display "NotVerified.gif" if Approved is False.

I have been trying to do this but until now I wasn't able to get what I
need.
Please, don't forget I am trying to create the columns from the ASPX.VB
code.

Could someone, please, help me with this?

Thank You,
Miguel

P.S: I am working on Asp.Net 2.0.
My GridView is allready binded to the dataset.

Feb 8 '06 #1
1 1682
For both instances use the Tamplate Column. Thith the Template Column you
can do anything.

For #1 you could add in a literal control so that you could add any kind of
html to it.

For #2 you could Use the image control and reference the bound data like
this:

Create a function that will return either a verified.gif image path or a
notverified.gif image path like so:

In your VB code:

Function getImagePath(byval boolApproved as boolean) as string
Dim strPath as string

If boolApproved = True then
strPath = "verified.gif"
End If

If boolApproved = False then
strPath = "notverified.gif"
End If

Return strPath
End function

Now in your template column inside the item template tag and inside the
asp:image tag put this as your image path:

In your HTML:

imagePath='<# getImagePath(Eval("Approved")) #>'

Hope this makes sense.

Anyone else tap in if you got another way of doing this.

If this code is sloppy forgive me as I am just doing this from the top of my
head.

Thanks,

J
"Miguel Dias Moura" <md*REMOVE*moura@gmail*NOSPAM*.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a dataset with 2 fields, [Text](String) and [Approved](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 [Text] field might be something like
"<h1>Heading</h1><p>Paragraph</p>

2. Column which will display an image:
It will display "Verified.gif" if Approved is True.
It will display "NotVerified.gif" if Approved is False.

I have been trying to do this but until now I wasn't able to get what I
need.
Please, don't forget I am trying to create the columns from the ASPX.VB
code.

Could someone, please, help me with this?

Thank You,
Miguel

P.S: I am working on Asp.Net 2.0.
My GridView is allready binded to the dataset.

Feb 9 '06 #2

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

Similar topics

4
by: Hans Merkl | last post by:
Hi, Is there a way to show the column headers of a GridView control even if there is no data? The only thing I see is the EmptyDataTemplate but I would also like to display the column headers. ...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: hammad.awan_nospam | last post by:
Hello, I am using ASP.NET 2.0. What I have done is nested a gridview inside another column of a gridview using a template data field column declaritively in my web form. Inside this child...
1
by: Eric | last post by:
I have a GridView control that I want to sort on multiple columns when I click a particular column. For example, I display Last name + ", " + First name in the first column and display id in the...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
4
by: bryan | last post by:
Hi all, I am working on a .net 2.0 web app. On page load I display a gridview with a drop down list (Employees), when the user selects from the drop down list, the grid view is filled with...
1
by: =?Utf-8?B?UGF0cmljayBG?= | last post by:
I have a gridview on the page that i want to dynamically populate with radiobuttons, so i went out on the net and found something that works perfectly, it created radionuttons and the postback with...
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the right column in my GridView. The GridView consist of 2 columns, the problem column is the column on the right side. The problem is that it looks like...
3
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a GridView with a checkbox column in it called FromInsight, however this is not bound to the dataset, its value is based on another column from the dataset called sourceid For each...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...

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.