Hi Guys,
I have an ASP.NET GridView which displays a list of neighborhoods.
I wish a user (administrator) to be able to edit the neighborhood name.
Now, the database is quite complex, and as such, i can't simply provide an UpdateCommand / SqlDataSource for the GridView.
I bind the data manually (on first load, and on the PageIndexChanging event).
Binding/listing paged data is working fine.
However, i'm having trouble trying to UPDATE the data.
The user clicks the "Edit" button, the textbox for the neighborhood name is shown, i change the text, click "Update", but the RowUpdating event is not firing.
I basically want to grab the row that was edited, and perform a custom update using LINQ.
Is this not possible with a GridView? If it's not, what are my alternatives? A repeater with LinkButtons and a hidden textbox that can swap in/out the labels?
This is my GridView markup:
<asp:GridView ID="NeighborhoodsGrid"
AllowPaging="true"
PageSize="10"
AutoGenerateColumns="false"
EnableViewState="false"
OnPageIndexChanging="NeighborhoodsGridPageIndexChanging"
OnRowDataBound="NeighborhoodsGridRowDataBound"
OnRowEditing="NeighborhoodsGridRowEditing"
OnRowCancelingEdit="NeighborhoodsGridRowCancellingEdit"
OnRowUpdating="NeighborhoodsGridRowUpdating"
AutoGenerateEditButton="true"
runat="server">
And the code-behind:
protected void NeighborhoodsGridRowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow updatedRow = NeighborhoodsGrid.Rows[e.RowIndex]; // not firing. =(
}
I also have the GridView wrapped in an UpdatePanel, if that makes any difference (don't think it should).
Any ideas or alternative recommendations?