0

I notice there is a "AutoGenerateSelectionButton" function but it's not really what I want. I want to be able to two things when a row is clicked (anywhere of the row):

  1. change the color of that entire row.
  2. get the value of a specific column and update another table accordingly.

How can I acheive that without writing client-side javascript functions?

1
  • Is this a webform or winform? Commented Mar 13, 2012 at 20:29

1 Answer 1

2

Assuming this is a webform, you need to access SelectedIndexChanged event of the gridview using a codebehind file.

from here you can modify properties

 protected void ChangedRow(object sender, EventArgs e)
        {
            this.GridView1.SelectedRow.BackColor = System.Drawing.Color.Red;
....
        }
Sign up to request clarification or add additional context in comments.

6 Comments

It doesn't seem to be working. The data is generated from a SQLDataSource. protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { this.GridView1.SelectedRow.BackColor = System.Drawing.Color.Red; }
And I did not enable "AutoGenerateSelectionButton". I want the user to be able to click anywhere on the row instead of the "Select" column in the front.
Are you using a direct data connection are you creating a model that binds to the grid?
I'm using a direct data connection by specifying the data source directly from the SqlDataSource that I created.
@Yang my problem was with UltraGrid (3rd party) From what I can see the Microsoft grid view doesn't have an easy way to access the selected cell. If i don't fall to straight to sleep when I get home I will try and see if i can help more.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.