Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datagrid ItemCommand Event Not Firing

Reply
Thread Tools

Datagrid ItemCommand Event Not Firing

 
 
=?Utf-8?B?RGVlcGVzaA==?=
Guest
Posts: n/a
 
      10-05-2005
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!
 
Reply With Quote
 
 
 
 
Patirck Ige
Guest
Posts: n/a
 
      10-05-2005
Have you set the UpDateCommand etc in your DataGrid?
Patrick


"Deepesh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGVlcGVzaA==?=
Guest
Posts: n/a
 
      10-06-2005
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...

"Patirck Ige" wrote:

> Have you set the UpDateCommand etc in your DataGrid?
> Patrick
>
>
> "Deepesh" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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!

>
>
>

 
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
Event ItemCommand not firing in DataGrid (1.1) Andy ASP .Net 0 01-10-2007 12:07 AM
ItemCommand event not firing from a dynamic user control,feeling puzzled EvelynAnd Ethan ASP .Net 4 01-09-2006 03:12 AM
DataGrid ItemCommand event not firing if not first page =?Utf-8?B?ZGFuYw==?= ASP .Net 3 10-26-2005 05:24 PM
ImageButton not firing ItemCommand event for the datagrid John ASP .Net Datagrid Control 0 08-04-2005 02:13 PM
Dynamic Datagrid Creation - ItemCommand event not firing PD ASP .Net Datagrid Control 0 10-23-2003 03:48 PM



Advertisments