views:

287

answers:

1

Hi there,

Is there any way to get a GridViewRow's DataItem property in the handler for an arbitrary post-back??

All DataItems have values during the RowDataBound event, but are null in Button_Click for example, im assuming because the Grid is in the process of being databaound in the first event.

I do some formatting on the fly in RowDataBound so cannot retreive the original value from a particular cell using row.Cells[x].Text at any time after that, so im pretty sure i need the original DataItem. The DataItem is an Entity object.

Any ideas?

A: 

I think what problem here is...
you are trying to bind data in page load event, When Click button it again bind data to gridview. you should bind data like..... when you click your grid should not bind again

 if (!Page.IsPostBack)
    {
        GridView1.DataBind();
    }
Muhammad Akhtar