views:

592

answers:

1

Hear in row databound onclick event its Printing 'Hi' when i click on any row ...But it has to print 'Hi' on click of 15th row only .....I am facing this problem ...plz reply.

protected void dtvExDetails_RowDataBound1(object sender, GridViewRowEventArgs e) {

    if (e.Row.DataItemIndex == -1)
        return;

    e.Row.Attributes.Add("onMouseOver","this.style.cursor='hand';");
    e.Row.Attributes.Add("onclick", this.GetPostBackClientEvent(dtvExDetails, "Select$15"));
}


protected void dtvExDetails_SelectedIndexChanged(object sender, EventArgs e)
{
    Response.Write("hi");
    DataGrid();
}
A: 
  protected void dtvExDetails_SelectedIndexChanged(object sender, EventArgs e)
    {
            GridViewRow selrow = sender as GridViewRow;

            if(selrow.Count == 15)
                Response.Write("hi");
            DataGrid();
    }
Samiksha
Thanks but better use this ...its working fine...if (e.Row.DataItemIndex == 14) { e.Row.Attributes.Add("onclick", this.GetPostBackClientEvent(dtvExDetails, "Select$15")); }