protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            detailview1.PageIndex = GridView1.SelectIndexl;

        }

this show gridview first page data when i go to second page of griedviw detail view show dat which is in first page of griedview not a current dta why?

Hi,

GridView.SelectedIndexChanged Event occurs when a row's Select button is clicked, but after the GridView control handles the select operation. GridView.SelectedIndex property returns the zero-based index of the selected row in a GridView control. You are trying to assign the row index to the PageIndex property which is completely wrong.

After setting up PageIndex, please rebind the detailsview

In case, if you are using SqlDatasource then

detailview1.PageIndex = GridView1.SelectIndexl;
defailview1.DataBind();

Hi Kiran,

Ignore my previous post. I though you assigned the GridView.SelectedIndex to GridView.PageIndex. I didn't see detailview1.PageIndex properly.

Sorry for the inconvenience. Please follow the adatapost reply.

commented: Hey pal! No need to say sorry :) OP is unclear. +12
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.