All,
I have a datagrid that appears to be calling the OnItemDataBound event twice - once when the page loads and again when it posts.
My page_load event does check for postback, like so:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadAllBooks();
}
}
This part works fine but when I click a button to do a postback, the OnItemDataBound event appears to fire again as it does some edits to the data in the datagrid and I can visually see some changes.
It doesn't appear to reload the datagrid; viewstate is intact and the checkboxes that I check prior to postback are retained.
Here's the shortened version of the OnItemDataBound event:
public void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
}
Commenting out the code in the OnItemDataBound event prevents the changes.
What am I missing? Is there something wrong with the OnItemDataBound event that anyone can see? This is the first time I've seen this.
Thanks,
Mark
I have a datagrid that appears to be calling the OnItemDataBound event twice - once when the page loads and again when it posts.
My page_load event does check for postback, like so:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadAllBooks();
}
}
This part works fine but when I click a button to do a postback, the OnItemDataBound event appears to fire again as it does some edits to the data in the datagrid and I can visually see some changes.
It doesn't appear to reload the datagrid; viewstate is intact and the checkboxes that I check prior to postback are retained.
Here's the shortened version of the OnItemDataBound event:
public void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
}
Commenting out the code in the OnItemDataBound event prevents the changes.
What am I missing? Is there something wrong with the OnItemDataBound event that anyone can see? This is the first time I've seen this.
Thanks,
Mark