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

How to get the cell index of gridview in the event selectindexchanged?

Dear my buddy,

Does anyone know how to get the cell index of gridview in the event selectindexchanged?

Regards,
Nimol
Mar 18 '10 #1
4 6563
Frinavale
9,735 Expert Mod 8TB
The GridView's SelectedIndexChanged Event is fired when the user selects a Row in a GridView....

You can use this row to retrieve a specific cell if you need to.

I'm not sure if this answers your question, if it doesn't please explain what you are trying to do in more detail so that we can help you further.

-Frinny
Mar 18 '10 #2
so how can use this row to retrieve a specific cell ??
Mar 19 '10 #3
liawcv
33
If what you want is simply the text displayed within a particular cell, the following may work:

GridView1.SelectedRow.Cells[3].Text

Where the "3" is the index of the cell. Simply, 1st cell index 0, 2nd cell index 1, and so on. The code above will not work if you are using more complex column e.g. TemplateField, etc.

For TemplateField, using FindControl("...") method e.g.

GridView1.SelectedRow.FindControl("Control_ID")
Mar 19 '10 #4
yes,if we use code below it will works..but i dun meant that..what i want is when user click any culumn it's will get the index..not select the specific like this code below.

GridView1.SelectedRow.Cells[3].Text
Mar 19 '10 #5

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

Similar topics

2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
2
by: wallermj | last post by:
I want to be able to compare the old combobox index to the newly selected combobox index in the SelectIndexChanged event. How can I do that? I know I could store the last selected value for the...
0
by: tfsmag | last post by:
I'm having a weird problem with the rowdatabound event for a gridview in my application... Here is the code. -------------------------------------- Protected Sub AnswersGrid_RowDataBound(ByVal...
1
by: K B | last post by:
I would like to create a gridview as below: Project Name 1-1 1-2 1-3 1-4 1-5 1-6 Project 1 BLUE BLUE BLUE BLUE GREEN GREEN more projects I would like to fill the...
2
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I can return the rowindex using SelectedRow or SelectedIndex But, how do I get my code to return the cell or column index of a selected row in my gridview? thanx -- Regards,
3
by: Bill Gower | last post by:
I have an cell which contains a field member which is filled with String.Empty. When I retrieve the value in the cell with Cells.Text.ToString() and try to compare it to String.Empty, I can't...
2
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I've bind a grdiview to a database and it's working fine. but what I want to do is if the data in certain cell exceed the cell width the that cell will only show the words with some dots...
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
0
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hello I have some code to extend the gridview control as shown that hides the Select button and underlines the text as you scroll on it. I have also overridden the SelectIndexChanged event so...
4
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.