update event dosen't fire when grouping gridView with GridViewHelper
I'm working with a gridView and I already did Edit on Grid which worked just fine.But when I grouped a column using GridViewHelper,it just doesn't work anymore.Any ideea why?
I've noticed using OnUpdateRow function that when I choose Update it takes Edit as e.CommandName,but when I choose Cancel it takes Cancel,so it's only a problem with the Update.
Also I have the onUpdatingRow function when used with grouping,it dosen't fire.
Hi,
can you post code.
Did you try RowUpdating, this fires just before the update and also before RowUpdated. You can add some error handling to workout if there is a problem before attempting to update the row.
Something like this:
Code:
If args.StatementType = StatementType.Insert Then
Dim tw As System.IO.TextWriter = System.IO.File.AppendText("Error.log")
'tw.WriteLine("{0}: Cookie {1} Updated.", DateTime.Now, args.Row("CookieID", DataRowVersion.Original), args.Row("DateCreated", DataRowVersion.Original))
tw.Close()
End If
I've tried RowUpdating,but strangely it dosen't even go through taht code.I have a break point in my RowUpdating function but it dosen't even go there at all.
Here is my code:
<asp:GridView ID="cmdGridView" runat="server" DataKeyNames ="ComandaPosId"
BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
CellPadding="4" DataSourceID="cmdObjectData" ForeColor="Black" GridLines="Vertical"
AutoGenerateColumns="False" EnableViewState="False" OnRowCommand="grdCmd_RowCommand"
OnRowUpdating="GridView1_RowAdding" >
<Columns >
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
can i see the code for EditComandaPos?
Not used the gridview control so not sure why this : OnRowUpdating="GridView1_RowAdding" is not firing. I add the OnRowUpdating handler to my data adapter.
ok, check your stored procedure and make sure that you are passing the correct number of parameters to it. In the editComandaPos code you have 3 parameters but i looks like your only passing 2 in the update paramaters.
Unfortunetly that't not the problem.
I'm passing only 2 parameters because the third one is the DataKeyNames from gridView (DataKeyNames ="ComandaPosId") which is taken implicitly.
Anyway I've tried passing all three parameters like this
<UpdateParameters >
<asp:Parameter Name="comandaPosId" Type="Int32" />
<asp:Parameter Name ="Cantitate" Type ="Decimal" />
<asp:Parameter Name ="ObsProdus" Type ="String" />
</UpdateParameters
just to make sure,and that's not the problem.
This is the code for grouping..maybe that helps
GridViewHelper helper = new GridViewHelper(this.cmdGridView);
helper.RegisterGroup("grupaFamDen", true, true);
helper.GroupHeader += new GroupEvent(helper_GroupHeader);
ok never used GridViewHelper before so not sure what it can be, however i did have a look for a few examples and came up with this for you to try.
A couple of examples had this line of code at the end:
Bookmarks