Q:

CommandArgument not working for Cancel

I am using the Cancel twice inside of my edit item template. Once to actually Cancel, the other to update a record in the code behind and then close it when it is finished(to look the same as if it was cancelled). It works for the one that doesn't have an onClick event but not the one that does..
Two parts to this question and either solution is fine. Why is it not working for the save? or how can I "cancel" the edittemplate in the cs onclick event btnSave_click? Something to note is that I can't use the "Update" CommandName.
Here is my code.
        <EditItemTemplate>
            <tr>
                <td>
                    <asp:TextBox ID="tbEditedNoteText" runat="server" Text='<%# Eval("NoteText")%>' TextMode="MultiLine" Rows="3" Columns="60"></asp:TextBox>
                </td>
                <td>
                    '<% =CurrentUser%>'
                </td>
                <td>
                    '<% =CurrentDate%>'
                </td>
                <td>
                    <table>
                        <tr>
                            <td>
                                <asp:Button runat="server" ID="btnSave" CommandName="Cancel" CommandArgument='<%# Eval("NoteId")%>' Text="Save" OnClick="btnSave_Click" /></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button runat="server" ID="btnCancel" CommandName="Cancel" Text="Cancel" />
                            </td>
                        </tr>
                    </table>

                </td>
            </tr>
        </EditItemTemplate>

A:

Use RowCommand/ItemCommand event in your databoiund control for interacting with command actions, not button Click event.

