?
Solved

Select a row for highlighting - Gridview control with checkbox

Posted on 2007-07-30
2
Medium Priority
?
1,183 Views
Last Modified: 2008-01-09
I have a checkbox column in my gridview control. I want to make it so on checkchanged it selects the row or deselects the row so the row is highlighted. Here is the code I have so far. I just need to select the row now.

    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim CB As CheckBox
        CB = CType(sender, CheckBox)

        If CB.Checked = True Then
            'select the row so its highlighted
        ElseIf CB.Checked = False Then
            'unselect the row so its no longer highlighted
        End If
    End Sub
0
Comment
Question by:bertino12
2 Comments
 
LVL 14

Accepted Solution

by:
chinu1310 earned 2000 total points
ID: 19592402
Hi,

Couple of solutions here.
http://forums.asp.net/p/1079698/1594091.aspx

Hope it helps.
0
 
LVL 4

Expert Comment

by:Neotk
ID: 19592460
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim CB As CheckBox
        CB = CType(sender, CheckBox)

        If CB.Checked = True Then
            //I'm doing a cast on CheckBox parent to GridViewRow and then setting its color, do this in VB
            ((GridViewRow)CB.parent).BackColor = System.Drawing.Color.Red; //C# code, you must fit to VB
        ElseIf CB.Checked = False Then
           //I'm doing a cast on CheckBox parent to GridViewRow and then setting its color, do this in VB
           ((GridViewRow)CB.parent).BackColor = System.Drawing.Color.White; //C# code, you must fit to VB
        End If
    End Sub

Regards, Rodrigo Leote
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

621 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