protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.erdWidget.RetrieveingData += new RetrieveingGridDataEvent(erdWidget_RetrieveingData);
erdWidget.BindGrid();
BindDataToCheckBox(State.MaintainFavWidget.FavWidgetListResultUpdate);
}
}
页面回传的时候
#region refresh the grid
protected void radAjaxManageOne_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
if (e.Argument == "Rebind")
{
erdWidget.MasterTableView.SortExpressions.Clear();
erdWidget.MasterTableView.GroupByExpressions.Clear();
erdWidget.RetrieveingData += new RetrieveingGridDataEvent(erdWidget_RetrieveingDataTwo);
erdWidget.BindGrid();
}
else if (e.Argument == "RebindAndNavigate")
{
erdWidget.MasterTableView.SortExpressions.Clear();
erdWidget.MasterTableView.GroupByExpressions.Clear();
erdWidget.MasterTableView.CurrentPageIndex = erdWidget.MasterTableView.PageCount - 1;
erdWidget.Rebind();
}
}
#endregion
#region bind data to grid after update op
protected IEnumerable erdWidget_RetrieveingDataTwo(object source, Framework.Controls.ExtendedRadGridRetrieveingDataArgs args)
{
BindDataToCheckBox(State.MaintainFavWidget.FavWidgetListResultUpdate);
return State.MaintainFavWidget.FavWidgetListResultUpdate;
}
#endregion
checkbox数据绑定和onchanged事件
#region bind data to checkbox
protected void BindDataToCheckBox(IEnumerable<WidgetEntity> widgetEt)
{
int i = 0;
foreach (GridDataItem dataItem in erdWidget.MasterTableView.Items)
{
if(widgetEt.Count()>0)
{
(dataItem.FindControl("cbFavWidget") as CheckBox).Checked = widgetEt.ToList()[i].FavWidget;
}
++i;
}
}
protected void WidgetRowSelection(object sender, EventArgs e)
{
((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
}
#endregion
现在时页面回传的时候 protected void BindDataToCheckBox(IEnumerable<WidgetEntity> widgetEt)这个数据绑定函数要执行。但是不执行OnCheckedChanged事件。在grid控件中得checkbox全部变为false了???
叮当猫咪