DataGridView Link Column

G

Guest

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(DataGridViewAutoSizeColumnsMode.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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top