Datagrid ItemCommand Event Not Firing

G

Guest

Good day, I have a specific case of the DataGrid in my solution which is
causing the ItemCommand Event Not Firing.

So I'm creating a "Skinnable" set of controls. I seperate the actual ASCX
file and .CS file. When I initialize my .CS file, in that code there is a
method that goes:

Page.LoadControl(FILENAME)

Which associates a .ascx file with my .CS file, allowing me to plug in any
filename to change the presentation of my user control. Then, I get access to
each control in the user control by

SomeControl = skin.FindControl("NameOfControl").

- As such, one of the controls here is a DataGrid. In the .ascx part of this
solution, I have a <TemplateColumn>, in which <ItemColumn><asp: Button
id="Save" Command="Edit" runat=server></ItemColumn> and <EditItemColumn><asp:
Button id="Edit" Command="Edit" runat=server></EditItemColumn>

- In my .cs file, I DataBind() everytime. If I don't do this, when I click
any button on the datagrid, the datagrid disappears on the postback.

- I have event handler associated with the ItemCommand event for the dg.
Each case of the event handler also calls DataBind()

THE PROBLEM
- When I click the Edit button, the "Edit" ItemCommand Event is fired, and
since i'm changing the "EditItemIndex", the datagrid switches to edit mode,
and now I can see my "Save" button.
- HOWEVER, when I now click "Save", no ItemCommand Event is fired for some
peculiar reason. This is what I need help with.

For some reason the events are getting lost. If someone can help me out with
finding out why they are getting lost, or how to track what events are on the
"queue", it would be greatly appreciated.

also --- i tried using a <EditButtonColumn>, and I get some strange behavior
here too. When I click Edit, it emits a "Edit" command. Fine. But when I
subsequently click "Save", it emits a "Edit" command again ... ! Also, when I
click "Cancel", it emits no command.

Please Help!
 
G

Guest

I am assigning the ItemCommand Event Handler dynamically, ie in my .cs file.
And yes, all my <asp:button> have CommandName="Update", "Edit", or "Cancel"
and I have a switch e.CommandName statement in my event handler...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top