I have a button inside a user web control (.ascx) that does the postback. I would like the grid to refresh on the postback of the button click. Therefore, I refresh the grid in the aspx’s Page_Load:
if (IsPostBack)
Grid1.Rebind();
I also added validateRequest="false" EnableEventValidation="false" to <%@ Page%> to supress the invalid postback exception. This did refresh my grid on the web control button click postback. However, when I put the grid item in edit mode, none of the events in the edit form was fired, such as button click or combo’s selection change. I am guessing this is because Grid1.Rebind(); in Page_Load cause ItemDataBound event raised when an event was fired in the edit form. Here is my ItemDataBound handler:
protected void Grid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
MyCombo combo = editedItem.FindControl("myCombo") as MyCombo;
combo.UserName = UserName;
combo.DataBind();
}
}
Please help. Thanks,