473,386 Members | 1,819 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,386 software developers and data experts.

Adding a Hyperlink Column to the GridView.

45
Hi all I have a requirement wherein I want to dynamically populate the GridView columns. I have figured out a way to do that. It is as follows

Expand|Select|Wrap|Line Numbers
  1. SqlConnection con = new SqlConnection(connectionstring);
  2. SqlCommand cmd = new SqlCommand(strCmd, con);
  3. SqlDataAdapter da = new SqlDataAdapter(cmd);
  4. DataSet ds = new DataSet();
  5. DataTable dt = new DataTable();
  6. gv.Columns.Clear();
  7. DataView dv = dt.DefaultView;
  8.             foreach (DataColumn dc in dt.Columns)
  9.             {                
  10.                 HyperLinkField hf = new HyperLinkField();
  11.                 hf.HeaderText = dc.ColumnName;
  12.                 hf.DataField = dc.ColumnName;
  13.                 //hf.NavigateUrl = "";
  14.                 gv.Columns.Add(hf);
  15.             }
  16.  
  17. gv.DataSource = dv;
  18. gv.DataBind();

Note: Above code might not work unless some modifications are made


However, as I have not set the NavigateUrl property of the HyperLinkField hf, the links are inacitve.

What I need is that when I click on a link, a panel on the same page which is previously invisible becomes visible.

How should I go about this??

Thanks a lot...
Dec 18 '07 #1
0 1779

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
3
by: Bren | last post by:
Hi All VS2005 Gridview control with vb I am populating a gridview of company staff. One of the columns is a hyperlink to a SMS texting facility I have so secrataries can text the managers...
3
by: William LaMartin | last post by:
I have a gridview (with no properties set) on an aspx page which I populate from an XML file with the code below. The data in the XML file looks like this <description>National Trust for...
3
by: shapper | last post by:
Hello, In my GridView I have a HyperLink Field where I set the DataNavigateUrlFormaString MyHyperLinkField.DataNavigateUrlFormatString = "~\RSS.ashx?Channel={0}&Culture=" &...
1
by: bbawa1 | last post by:
I have a table with two columns AppName AppLocation TestApp1 folder1 TestApp2 folder2 TestApp3 folder3 TestApp4 folder4 TestApp5 folder5
0
by: bbawa1 | last post by:
I have a table with two columns AppName AppLocation TestApp1 folder1 TestApp2 folder2 TestApp3 folder3 TestApp4 folder4 TestApp5 folder5
1
by: Frank Milverckowitz | last post by:
Hi, I'm trying to do something common and what should be simple using the GridView "Add Columns" feature in Visual Studio 2005. All I want to do is add a Hyperlink column that will take the...
4
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi I have a GridView that is displaying master records. Some of these records have child records. I would like to a column to my master GridView such that for each master record that has...
1
by: Valli | last post by:
Hi, I need to display an hyperlink column in gridview where if the user clicks that column the page should move to the selected page. I have got help from this group & started using template...
1
by: Author | last post by:
I got into trouble with this problem. The data I am presenting in a GridView control has a column called "Website". That data comes from a stored procedure in SQL Server 2000. Most of them...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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,...

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.