Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > GridView update and cancel buttons fire RowCommand with Edit button as CommandSource

Reply
Thread Tools

GridView update and cancel buttons fire RowCommand with Edit button as CommandSource

 
 
Marco Liedekerken
Guest
Posts: n/a
 
      11-08-2006
Hi folks,

When I click on a update or cancel button the wrong event is fired to
my RowCommand event handler.

My Gridview code (shown down under) uses a CommandField with
ShowEditButtonset to true.

Strange thing is that when I use AutoGenerateEditButton="true" and
remove my CommandField, the cancel button work fine and the update
button still fires the edit event to my RowCommand event handler
(instead of the update event which would be normal for a update
button).

I made a simple sample with only the GridView and it works fine
(updating the DB like I wanted)!

I am using the 180 day trial version of VS.NET 2005 and my GridView
control is inside a usercontrol which is inside a contentpage. Can
there be a problem with ViewState (which does not remember the Update
button who is being places after clicking the Edit button) and how can
I check on this? I hoped that everything would be automaticly
intuitive, but I seem to struggle with the GridView (maybe my problem
is on a different level then the GridView alone ...)! My previous post
is also strange and I think it is connected to this one.

Are there any experts who can give me a clue?

thanks for the help, Marco



<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlDataSource1" DataKeyNames="MutaP_StartDate"
AutoGenerateColumns="False" AllowPaging="true" AllowSorting="true"
CellPadding="4" ForeColor="#333333" GridLines="None"
OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowCommand="GridView1_RowCommand" OnRowEditing="GridView1_RowEditing"
OnRowUpdated="GridView1_RowUpdated"
OnRowUpdating="GridView1_RowUpdating">
<Columns>
<asp:BoundField HeaderText="StartDatum"
DataField="MutaP_StartDate" ReadOnly="true" />
<asp:BoundField HeaderText="Waarde"
DataField="MutaP_Value" />
<asp:BoundField HeaderText="Omschrijving "
DataField="MutaP_Description" />
<asp:BoundField HeaderText="Gewijzigd"
DataField="MutaP_ChangeTime" ReadOnly="true" />
<asp:CommandField ButtonType="Button"
ShowEditButton="true"/>
</Columns>
<HeaderStyle BackColor="#333399" ForeColor="#FFFFFF"
Font-Bold="True" />
<RowStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#333399" ForeColor="#FFFFFF"
HorizontalAlign="Center" />
</asp:GridView>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dropdownlist inside a gridview with Edit,Update,Cancel das ASP .Net Datagrid Control 0 09-18-2006 01:35 PM
HELP CANCEL CANCEL CANCEL Carmen Rosario Computer Support 7 04-06-2005 11:04 PM
CANT see EDIT UPDATE CANCEL Buttons for DATAGRID =?Utf-8?B?cG11ZA==?= ASP .Net 3 12-28-2004 04:07 PM
RE: Setting CssClass on Edit, Update & Cancel buttons =?Utf-8?B?SmFjcXVlcyBMZWNsZXJj?= ASP .Net 0 07-06-2004 08:56 PM
CssClass on DataGrid Edit, Update & Cancel buttons =?Utf-8?B?U3RldmUgS2FsbGFs?= ASP .Net 0 07-06-2004 04:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57