protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName.Equals(""))
    {
        int index = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;    }
}
protected void ImageButton1_Click(object sender, EventArgs e)
    {
        GridViewRow gvr = (sender as ImageButton).NamingContainer as GridViewRow;
        if(gvr != null)
        {
            
        }
    } 

解决方案 »

  1.   


    protected void biao1_Click(object sender, EventArgs e)
      {
      GridViewRow gvr =(GridViewRow)((sender as ImageButton).Parent.Parent);
      if(gvr != null)
      {
       ImageButton biao1=(ImageButton) gvr.FindControl("biao1");
       biao1.ImageUrl="要换的图片";
       //至于行文字变色,你可以将文字放在LABLE内 
       //用上边同样的方法获取到Lable ,然后设置一下lable的backgroundcolor
      }
      }  
      

  2.   

    我说的这个ImageButton控件是在GridViewRow控件中用的!