Chevy Mark Sunderland

Chevy Mark Sunderland

  • NA
  • 188
  • 166.7k

Protected void `RowUpdated`, `RowCancelingEdit` and `RowEditing`

Mar 28 2012 11:09 AM
Hi there, I hope your appreciated help.
First of all I must say that I am a newbie when it comes to net language.

This is the GridView: I have problem with the `alerts` of protected void `RowUpdated`, `RowCancelingEdit` and `RowEditing`.
I need for single row is edit or update or cancel print the output `OK` or `KO` in the `lblMessage`.

Now when update the single row I have only output "OK" and If switch the following row for upgrade this output remains fixed printed in the net page...

Can you help me? thank you in advance.
Your help would be very appreciated


protected void GridView1_RowUpdated(Object sender, GridViewUpdatedEventArgs e)
{
if (e.Exception != null)
{
this.lblMessage.Text = e.Exception.Message;

}
else
{
e.ExceptionHandled = true;
this.lblMessage.Text = "OK";

}

}

protected void GridView1_RowCancelingEdit(Object sender, GridViewCancelEditEventArgs e)
{

}

protected void GridView1_RowEditing(Object sender, GridViewEditEventArgs e)
{

}

...

<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlDataSource1"
DataKeyNames="ID"
AllowSorting="True"
AllowPaging="True"
PageSize="15"
AutoGenerateColumns="false"
CssClass="first"
OnRowUpdated="GridView1_RowUpdated"
OnRowcancelingedit="GridView1_RowCancelingEdit"
OnrowEditing="GridView1_RowEditing">

...

</asp:GridView>

<asp:Label ID="lblMessage" ForeColor="Red" runat="server" />

...

Answers (1)