I have gridview binded from database..
I have following code:
protected void Page_Load(object sender, EventArgs e)
{
BindGrid();
}
Now, I have checkBox and drop-down inside the gridView, When user selects some rows from checkboxes and clicks on Update Button, Page_Load event fires and calls BindGrid(); method and selected rows should get hidden.
How can I retain checkbox values after the page load event.
I don’t want to use IsPostBack property in Page load because I have used Paging.
How can I solve my problem?
You should only
DataBindthe GridViewif(!Page.IsPostback). Otherwise no events are triggered and ViewState values(like SelectedIndex etc.) are overwritten from theDataSourcevalues.http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback%28v=VS.100%29.aspx
You also should call
BindGridfrom following event-handlers:PageIndexChangingSelectedIndexChangedSorting