473,396 Members | 2,147 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,396 software developers and data experts.

gridview row selection

how can we select a row of a gridview and pass the values of this row to textbox.
please reply me with c#.net codes not html codes.
thanks a lot
May 5 '10 #1
1 1717
Frinavale
9,735 Expert Mod 8TB
The easiest way to do this is to add a CommandField column to the GridView with a "selection" button in it.

Quick not working example:
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView id="someGrid" runat="server">
  2.   <Columns>
  3.    <asp:CommandField ShowSelectButton="true" />
  4.  </Columns>
  5. </asp:GridView>
Then you would handle the GridView.SelectedIndexChanged Event. This event is passed a parameter "e" that is a GridViewSelectEventArgs type. This contains information about the row that was selected so that you can reference it in your C# code. Once you have a reference to the row you can use the row's FindControl() method to retrieve any controls in the row...or you can access the individual cells.

-Frinny
May 5 '10 #2

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

Similar topics

1
by: MasterChief | last post by:
Is it possible to select an item on a gridview by clicking on it and then being able to click a link for example that says EditOrder in a treeview and have the EditOrder page open up viewing what...
3
by: mateo | last post by:
Hello, I have a GridView inside which i want to show 3 dropdownList (one for each Column). So i've created 3 TemplateField Continent Country City
3
by: CK | last post by:
Good morning all, I had a quick question, I would like to make a row in a gridview selectable. Currently there is a asp:CommandField as one of the colums. This selects the current row when...
10
by: Carlos | last post by:
Hi all, I have a form with an input radio control in a template field. When the user selects an option, and press a button the selection disappears.. I would like the selection to persist after...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
0
geo039
by: geo039 | last post by:
I have a usercontrol with textboxes. Most of which refer to a gridview on selection. A user clicks a looking glass and a gridview appears to select items (like a dropdown). The page loads with...
0
by: Rasika WIJAYARATNE | last post by:
Hi everyone, I have two grid-views and I am trying to populate the data on gv2 based on the selection in gv1. However when a row is selected in gv1, it doesn't populate the gv2 with data. I have...
1
by: Vajrala Narendra | last post by:
Hi, this is Narendra in .net From grid view, while selecting a record have to display the contents in controls, i had done this one in grid view select index changed event but here am going...
2
by: RobertTheProgrammer | last post by:
Hi all, I've got a GridView for which I need to populate the rows with something a little more complicated than a simple SQL statement, thus the SelectCommand won't work. What I'd like to do is...
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
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
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,...
0
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.