473,769 Members | 7,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>Headin g</h1><p>Paragraph </p>

2. Column which will display an image:
It will display "Verified.g if" if Approved is True.
It will display "NotVerified.gi f" 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 1697
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(by val boolApproved as boolean) as string
Dim strPath as string

If boolApproved = True then
strPath = "verified.g if"
End If

If boolApproved = False then
strPath = "notverified.gi f"
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(Ev al("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*mour a@gmail*NOSPAM* .com> wrote in message
news:Ob******** ******@TK2MSFTN GP10.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>Headin g</h1><p>Paragraph </p>

2. Column which will display an image:
It will display "Verified.g if" if Approved is True.
It will display "NotVerified.gi f" 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
5097
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. Thanks Hans
7
14819
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 want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
0
2208
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 gridview I have set an ItemStyle property of width 20% for the first templated field which contains a hyperlink control, and an ItemStyle of width 80% for the second templated field which contains a label. Both of these controls are databound to...
1
3548
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 second column. When clicking on the first column, I want the GridView to sort on LastName and FirstName. Based on Microsoft's documentation of SortExpression property, all I have to do is to set SortExpression=LastName,FirstName on the first column....
5
6454
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 dataset with a join query for the GetData() select method. I use ObjectDataStore to couple the GridView with the table adapter on the dataset. If I point the ODS at the child table, the GridView will bind to the "normal" select and I end up...
4
15364
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 the dates the employees are working. I then want to push a button that adds a new column to the gridview, a new Employees drop down list appears, and again the user selects the
1
3885
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 the works. My problem is that i want to send 2 columns to the gridview instead of 1, but i cant figure out how to add the second column to the gridview. <asp:GridView ID="GridView1" AutoGenerateColumns="false" runat="server" ShowHeader="false">...
1
6736
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 there is a huge space between the 2 columns, see the huge grey space between the 2 columns. I want the columns to be very close to each other with only 10px open space between the columns. Now it looks like there is a 160px margin between them
3
9009
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 row FromInsight = true if (SourceId 0). I try to loop around the gridview and add the value of the checkbox but the column seems to have no checked value, please can you help with this. Thanx in advance Robert
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.