单击DetailsView cancelButton时是否触发了任何服务器端事件?

时间:2022-08-09 17:03:22

When in Insert Mode or Edit Mode of DetailsView, the default behavior of click CancelButton is clear inputs in TextBox. But I just want to redirect to other pages instead of clear inputs. I hope there is server side event triggered so I can Response.Redirect.

在DetailsView的Insert Mode或Edit Mode中,单击CancelButton的默认行为是TextBox中的清晰输入。但我只想重定向到其他页面而不是明确的输入。我希望有服务器端事件触发,所以我可以Response.Redirect。

Client side (some JS?) redirect is fine too.

客户端(一些JS?)重定向也很好。

1 个解决方案

#1


Check out the ModeChanging Event and CancelingEdit Property.

查看ModeChanging事件和CancelingEdit属性。

void DetailsView_ModeChanging(Object sender, DetailsViewModeEventArgs e)
{
    if (e.NewMode == DetailsViewMode.Edit ||
        e.NewMode == DetailsViewMode.Insert)
    {
        if (e.CancelingEdit)
        {
            //canceled
        }
    }
}

#1


Check out the ModeChanging Event and CancelingEdit Property.

查看ModeChanging事件和CancelingEdit属性。

void DetailsView_ModeChanging(Object sender, DetailsViewModeEventArgs e)
{
    if (e.NewMode == DetailsViewMode.Edit ||
        e.NewMode == DetailsViewMode.Insert)
    {
        if (e.CancelingEdit)
        {
            //canceled
        }
    }
}