View Single Post
  #1 (permalink)  
Old February 15th, 2008, 09:33 AM
rao965 rao965 is offline
Authorized User
 
Join Date: Jul 2006
Location: , , United Kingdom.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Select row in GridView WITHOUT using Select button

Hi,
I have two GridView (Master/detail) controls on the same page. I want to be able to populate the second GridView when I click on each row in first GridView without showing the Select button or ID field on the first GridView. I have used RowDataBound event to make each rows selectable as follows but I can not get the value of ID field. Is anyone has an idea how should I approch this. Mant thanks in advance for your help.
Code:
 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.BackColor='Yellow';";
            e.Row.Attributes["onmouseout"] = "this.style.BackColor='red';";

            e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex);


        }

    }


Regards

Rao