problem with GridView derived control selected items state maintainance set/reset
-
hi, in my project we are using asp.net 2.0 GridView in so many places. Through out the project we are using GridView derived control.
public class GridView : System.Web.UI.WebControls.GridView
{
//logic
}i have added code to maintain seleced checkboxes state, DataKey value ID of selected rows if user selects multiple rows from multiple pages navigation. i am storing the 1) ID, 2) Selected in the ViewState in the form of List. For this i have 2 methods
StoreCurrentViewState() //Here i am adding, removing the entries into the ViewState list
RestorePastViewState //Here i am resetting the checkedboxes.this code i have used at...
protected override void OnPageIndexChanging(GridViewPageEventArgs e)
{
StoreCurrentViewState();
base.OnPageIndexChanging(e);
RestorePastViewState();
}also added at
protected override void OnDataBinding(EventArgs e)
{
StoreCurrentViewState();
base.OnDataBinding(e);
}protected override void OnDataBound(EventArgs e)
{
base.OnDataBound(e);
RestorePastViewState();
}it is maintaining selected checkboxes states during the gridview page naigation. my query is ... in one aspx page i have 4 grids and for all page it is storing in single ViewState object. i wanted to store these values in sepearate viewstate for each gridview && i need to reset the ViewState object if gridview loads first time. How can i do? please provide ur inputs...
Ramana
-
hi, in my project we are using asp.net 2.0 GridView in so many places. Through out the project we are using GridView derived control.
public class GridView : System.Web.UI.WebControls.GridView
{
//logic
}i have added code to maintain seleced checkboxes state, DataKey value ID of selected rows if user selects multiple rows from multiple pages navigation. i am storing the 1) ID, 2) Selected in the ViewState in the form of List. For this i have 2 methods
StoreCurrentViewState() //Here i am adding, removing the entries into the ViewState list
RestorePastViewState //Here i am resetting the checkedboxes.this code i have used at...
protected override void OnPageIndexChanging(GridViewPageEventArgs e)
{
StoreCurrentViewState();
base.OnPageIndexChanging(e);
RestorePastViewState();
}also added at
protected override void OnDataBinding(EventArgs e)
{
StoreCurrentViewState();
base.OnDataBinding(e);
}protected override void OnDataBound(EventArgs e)
{
base.OnDataBound(e);
RestorePastViewState();
}it is maintaining selected checkboxes states during the gridview page naigation. my query is ... in one aspx page i have 4 grids and for all page it is storing in single ViewState object. i wanted to store these values in sepearate viewstate for each gridview && i need to reset the ViewState object if gridview loads first time. How can i do? please provide ur inputs...
Ramana
Use ID or UniqueID of GridViews as the key when storing to ViewState. As each ID is going to be unique in a page, they will be maintained separately for each GriView in ViewState object.
-
hi, in my project we are using asp.net 2.0 GridView in so many places. Through out the project we are using GridView derived control.
public class GridView : System.Web.UI.WebControls.GridView
{
//logic
}i have added code to maintain seleced checkboxes state, DataKey value ID of selected rows if user selects multiple rows from multiple pages navigation. i am storing the 1) ID, 2) Selected in the ViewState in the form of List. For this i have 2 methods
StoreCurrentViewState() //Here i am adding, removing the entries into the ViewState list
RestorePastViewState //Here i am resetting the checkedboxes.this code i have used at...
protected override void OnPageIndexChanging(GridViewPageEventArgs e)
{
StoreCurrentViewState();
base.OnPageIndexChanging(e);
RestorePastViewState();
}also added at
protected override void OnDataBinding(EventArgs e)
{
StoreCurrentViewState();
base.OnDataBinding(e);
}protected override void OnDataBound(EventArgs e)
{
base.OnDataBound(e);
RestorePastViewState();
}it is maintaining selected checkboxes states during the gridview page naigation. my query is ... in one aspx page i have 4 grids and for all page it is storing in single ViewState object. i wanted to store these values in sepearate viewstate for each gridview && i need to reset the ViewState object if gridview loads first time. How can i do? please provide ur inputs...
Ramana
store the viewstate as GridviewID$ID and then split it on restoring.