Is there a way to catch and re-interpret a GridView update event when tied to an XmlDataSource?
I have a GridView tied to an XmlDataSource to take advantage of the edit/update/delete capabilities GridView inherently offers开发者_开发知识库. XmlDataSource offers no update event handling so that must be performed manually. I have no problem with this.
My problem is how/where can I catch this update event to perform my custom handling.
Could you handle the
protected void grvFoo_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
Calling
e.Cancel = true;
Eg
protected void grvFoo_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//Your XML update code here
//Cancel the gridview calling the update
e.Cancel = true;
}
And on in the grids columns either have
asp:CommandField ShowEditButton="true"
Or a Button, within a template field, which CommandName = "Update" as this should trigger that event also.
精彩评论