Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to Get Column Index of a Row in GridView When a Footer Cell CheckBox Is Clicked

Posted on 2014-03-07
5
Medium Priority
?
2,134 Views
Last Modified: 2014-03-15
I have a GridView dynamically bind with database table.  I use TemplateField to create a CheckBox in each column's footer.  I added EventHandler when CheckedChanged for each CheckBox.  When user clicks CheckBox, I want to change color of entire column.   How do I get cell index when a CheckBox is clicked by user in CheckedChanged EvenHandler?
0
Comment
Question by:khrispy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:SriVaddadi
ID: 39914694
Type cast sender to CheckBox and access the Parent property and that would give you the cell. You can go from there.

GridViewRow Row = ((GridViewRow)((Control)sender).Parent.Parent);

GridViewColumn Col = (GridViewColumn)((Control)sender.Parent)
0
 

Author Comment

by:khrispy
ID: 39918874
GridViewColumn is Windows control.  I am using ASP .NET and I can't cast sender to GridViewColumn.  This is what I got stuck.
0
 

Accepted Solution

by:
khrispy earned 0 total points
ID: 39919343
I ended up get clicked CheckBox control and compare with each cell's CheckBox to get column number.
0
 
LVL 16

Expert Comment

by:SriVaddadi
ID: 39919423
oh ok.. but u could still use GridViewRow and get the Cells and it is of Type TableCell
0
 

Author Closing Comment

by:khrispy
ID: 39931100
I found the solution myself.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question