Solved

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

Posted on 2014-03-07
5
2,061 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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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