473,394 Members | 2,090 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,394 software developers and data experts.

Can I bind an array to GridView to show hyperlinked columns?

Hi,

Does anyone have an ASP 2.0 code sample that shows how to bind a
one-dimensional array to a GridView, such that the rows are shown as
hyperlinks?

Thanks
Ian

Apr 10 '06 #1
2 1542
Hi,

It is possible that if you use ListItem for items that store in arrays, the
below is a sample code that works fine. Only to do is setting that the
gridview has a hyperlinkfield and set DataNavigateUrlFields to "Text" and
set DataTextFields set to "Text".
If you want to use visible link name is different than the target then you
can use ListItem's "Value" property and set them in Arrays then change the
DataTextFields set to "Value".

If you use ArrayList:
ArrayList myListItem = new ArrayList();

myListItem.Add(new ListItem("http://www.yahoo.com"));

myListItem.Add(new ListItem("http://www.microsoft.com"));

GridView1.DataSource = myListItem;

GridView1.DataBind();

If you use ListItem Array:
ListItem[] myListItem = new ListItem[2];

myListItem[0]=new ListItem("www.yahoo.com");

myListItem[1]=new ListItem("www.microsoft.com");

GridView1.DataSource = myListItem;

GridView1.DataBind();

Have a nice work,

Aytaç ÖZAY
Software Developer

<ia********@yahoo.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hi,

Does anyone have an ASP 2.0 code sample that shows how to bind a
one-dimensional array to a GridView, such that the rows are shown as
hyperlinks?

Thanks
Ian

Apr 10 '06 #2
Thanks !

Ian

Apr 10 '06 #3

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

Similar topics

2
by: COHENMARVIN | last post by:
I'm leafing through a big book on asp.net, and I don't see any way to the following: 1. bind values and text to a dropdown 2. Also make the first line of the dropdown say something different. For...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView on an Aspx page. I need my GridView to have three columns: Name , City and Photo I want to declare the data in my Aspx.Vb code and bind it to my GridView. I...
0
by: teclioness | last post by:
Hi, I am using gridview for the user to update rows. In a row, there sre two columns, which need to be updated. When the gridview is to be shown, the row should show the values from database....
7
by: coosa | last post by:
In an asp.net 2.0 GridView web control, is it possible to display one column as a hyperlink which displays a name, such as item_name from a db table, but capures the item_id when clicked? If yes,...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow users to select "Members" of a group, where they check...
1
by: noor1234 | last post by:
Hi, My gridview should have columns containing both hyperlinked and non hyperlinked cells in the same column. Example - Say there are 4 rows and 4 columns in my grid, and the 3rd column should...
3
by: Steve Kershaw | last post by:
Hi, I need a way to bind a DirectoryInfo array to a GridView without any errors. The code I'm using to create the DirectoryInfo array is: // Define the current directory DirectoryInfo dir...
2
by: Ralf | last post by:
I have a custome request to print a gridview with lots of columns, 31 to be exact. I know how to print out a gridview, done it already for a GV with 6 columns. But, this GV is very wide and will...
0
by: cmrhema | last post by:
Hi, I have a gridview problem while binding more than two gridviews. I am giving a sample scenario of what I have done so far I have two tables First table: Department , having columns...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.