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

DataGridView Link Column

Hi All;

I'm working in VS2005, and have a DataGridView that is bound to a
datasource. Is there a way to change a column to be a link style column after
the DataGridView populates? Here's how I populate it:

DataSet ds = new DataSet();
dgvShipmentHistory.DataSource = null;
SqlDataAdapter da = new SqlDataAdapter(mySQLClass.Query, mySQLClass.SqlCon);
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(ds, "ShipmentHistory");
dgvShipmentHistory.DataSource = ds.Tables[0];
dgvShipmentHistory.AutoResizeColumns(DataGridViewA utoSizeColumnsMode.AllCells);
I want to be able to change one of the columns to be a link type column so
that users can click the hyperlink and I can throw up a page. I bind the
grid at runtime, so cannot do this at design time.

Thanks
Jul 11 '07 #1
1 8110
Rahvyn,

You are going to have to set all the columns to the appropriate types
then at runtime. Basically, you are going to have to call the Add method on
the Columns collection returned from the DataGridView for each column in
your grid, setting the link column appropriately based on your data.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rahvyn" <Ra****@discussions.microsoft.comwrote in message
news:C8**********************************@microsof t.com...
Hi All;

I'm working in VS2005, and have a DataGridView that is bound to a
datasource. Is there a way to change a column to be a link style column
after
the DataGridView populates? Here's how I populate it:

DataSet ds = new DataSet();
dgvShipmentHistory.DataSource = null;
SqlDataAdapter da = new SqlDataAdapter(mySQLClass.Query,
mySQLClass.SqlCon);
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(ds, "ShipmentHistory");
dgvShipmentHistory.DataSource = ds.Tables[0];
dgvShipmentHistory.AutoResizeColumns(DataGridViewA utoSizeColumnsMode.AllCells);
I want to be able to change one of the columns to be a link type column so
that users can click the hyperlink and I can throw up a page. I bind the
grid at runtime, so cannot do this at design time.

Thanks


Jul 11 '07 #2

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

Similar topics

1
by: Rich | last post by:
Hello, I am reading data from a sql server table that is under replication. This table has the replicatin GUID column that is generated with replicatin. I am reading the data from a...
2
by: Bob | last post by:
How do I show a calendar control or another appropriate control to pick a date and time for a cell in a column in a datagridview? Thanks for any help. Bob
4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
2
by: michael sorens | last post by:
I have been trying to figure out how to use DataSets, BindingSources, DataGridViews, and XML together, but it is a challenge. I understand how to populate a DataGridView with XML basically as: ...
0
by: Leanne | last post by:
I created a datagridview with two columns. The first column is textboxColumn (CategoryID), second one is a DataGridViewComboBoxColumn, call it "name". I hope the name column will only display all...
2
by: David Jackson | last post by:
Hello, I have a DataGridView which is populated from an Access database. The final column is a calculated column. I have set this to ReadOnly in the column collection properties, but now I would...
0
by: mahesh.nimbalkar | last post by:
I want to use Multi column sorting in DataGridView. The scenario is like this: 1) DataGridView has two columns; Id and name 2) User clicks on Id column and DataGridView is sorted...
4
by: gregarican | last post by:
I have a standard VC# 2005 DataGridView showing a group of records coming from a table. Currently I have a CellMouseDoubleClick event popping up a MessageBox which pulls a timestamp of the...
9
by: Miro | last post by:
My current headache is proper is with the datagridview I am starting to realize that a DataGridView within vs2008 is not as 'robust' as a 'textboxfield' by default for example. Example: A...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.