Click here to Skip to main content
15,078,444 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
please tell me

how i can select particular value of particular Colum from data grid view?

when i select one row from data gride view then auto seclect one textbox value one colum
phil.o 7-Mar-14 10:48am
With the mouse?
Krunal Rohit 7-Mar-14 10:52am

1 solution

Assuming you are trying to do this in some code-behind somewhere then there is a function to select a particular row...
where x is an Integer.

If you want to get at a particular column after that then you can use the Cells property, e.g.
aLabel.Text = GridView1.SelectedRow.Cells(y).Text
where y is some other Integer

If you have selected a particular cell with your mouse or keyboard then the event fired will provide a parameter e of an appropriate type. It will have properties that will enable you to determine which row was selected / affected.

For example if e As System.Web.UI.WebControls.GridViewRowEventArgs is the parameter then
will return the 3rd column of the row being affected. Sometimes the property you want will be "AffectedRows" - use the intellisense to work out which one you need in each instance.

This codeproject article should also prove useful to you CodeProject Frequently Asked Questions Series 1: The ASP.NET GridView[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900