ASP.NET - Gridview - Asked By Naresh Kumar on 11-Feb-10 01:21 AM

Hi All,

I had a gridview and I am binding all the rows to the gridview on Loading, but some rows are hidden. When I click on the row the hidden rows should be displayed(but only some rows having onclick option).

Can any one please tell me how to get this.

Huggy Bear replied to Naresh Kumar on 11-Feb-10 01:39 AM
I don't understand the context. How do you click on the hidden row? If you want to display the hidden rows on click on the visible rows, why is this required?
Still if you want to do so then make use of the SelectedIndexChanged event of the GridView
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    foreach (GridViewRow row in GridView1.Rows)
        //if invisible
        if (!row.Visible)
            row.Visible = true;//set as visible
Naresh Kumar replied to Huggy Bear on 11-Feb-10 01:56 AM
On load I am getting say 20rows but I will make 10rows hidden and remaining 10rows visible based on some conditions in Databound method. Then any one click on the row which is visible then that hidden rows should be visible.
Huggy Bear replied to Naresh Kumar on 11-Feb-10 04:04 AM
Did you try with the SelectedIndexChanged event as I said in my previous post?