473,671 Members | 2,288 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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();
dgvShipmentHist ory.DataSource = null;
SqlDataAdapter da = new SqlDataAdapter( mySQLClass.Quer y, mySQLClass.SqlC on);
da.MissingSchem aAction = MissingSchemaAc tion.AddWithKey ;
da.Fill(ds, "ShipmentHistor y");
dgvShipmentHist ory.DataSource = ds.Tables[0];
dgvShipmentHist ory.AutoResizeC olumns(DataGrid ViewAutoSizeCol umnsMode.AllCel ls);
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 8131
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.co m

"Rahvyn" <Ra****@discuss ions.microsoft. comwrote in message
news:C8******** *************** ***********@mic rosoft.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();
dgvShipmentHist ory.DataSource = null;
SqlDataAdapter da = new SqlDataAdapter( mySQLClass.Quer y,
mySQLClass.SqlC on);
da.MissingSchem aAction = MissingSchemaAc tion.AddWithKey ;
da.Fill(ds, "ShipmentHistor y");
dgvShipmentHist ory.DataSource = ds.Tables[0];
dgvShipmentHist ory.AutoResizeC olumns(DataGrid ViewAutoSizeCol umnsMode.AllCel ls);
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
2306
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 dataAdapter/Dataset using a dataview which is the data source for a datagridview control. When I scroll horizontally in the datagridview control and reach this GUID column (which is not at the end of the table) it raises the datagridview dataError event. ...
2
15158
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
8628
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 tell me if this is even possible, and if so, how to do it? If this is completely impossible, how would you suggest going about sorting a ComboBox wherein the text displayed in the column is the client's name, and the underlying value is an ID? ...
2
7814
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: DataSet ds = new DataSet(); ds.ReadXml(@"\usr\tmp\sample.xml"); dataGridView.DataSource = ds; dataGridView.DataMember = "targetElement"; What I found through experimentation is that the DataMember may specify
0
1332
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 the names related to the CategoryID, not all the names from the table. I have two datasource, dsCategoryID contains all the Category IDs from database, dsName contains all the names for all the Category IDs. The "name" column has the following...
2
3127
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 like to prevent the users from even entering that column while they are tabbing through the cells in the DataGridView sort of like setting TabStop to false on other controls. Is this possible? I couldn't find any property of the column which...
0
3906
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 ascending 3) User clicks on Id column and DataGridView is sorted descendin Now, when user clicks on name column, the DataGridView should be sorted as Id desc and name asc.
4
40784
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 transaction from a related table based on the row in the DataGridView that the double click was registered against. I didn't want to add the extra column with this timestamp info into the DataGridView since it's not always needed by the enduser. ...
9
3414
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 Textbox field can have masking, you can add easy validation and so on. Just adding a dummy datagridview to a form, databounding it, and allowing editing works - but is not dummy proof.
0
8471
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
8388
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
8817
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...
0
8663
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5687
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
4215
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...
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.