473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Datagrid ItemCommand Event Not Firing

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!
Nov 19 '05 #1
2 3342
Have you set the UpDateCommand etc in your DataGrid?
Patrick
"Deepesh" <De*****@discussions.microsoft.com> wrote in message
news:EA**********************************@microsof t.com...
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!

Nov 19 '05 #2
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" <De*****@discussions.microsoft.com> wrote in message
news:EA**********************************@microsof t.com...
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!


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Colin Ramsay | last post by:
Hi all, I don't normally post swathes of code like this but I am truly banging my head off my desk here... I've dynamically created a datagrid within a usercontrol. There are two columns...
2
by: vinay | last post by:
I implemented paging on this grid OnPageIndexChanged="dgSales_Page" When i click Next page, it is firing OnItemCommand insted of OnPageIndexChanged ??? <asp:datagrid id="dgSales"...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
2
by: Lagwagon | last post by:
I have an Image Button inside of a Datagrid and its not firing the datagrid.itemcommand event when it is clicked. Does anyone have a link to a tutorial or a solution for this problem? For my...
3
by: Mark Gilkes | last post by:
Hi, I have an aspx page in which I am building a DataGrid control in the code-behind dynamically. The DataGrid is declared along with BoundColumns and bound to the datasource, then added to a...
1
by: Mark Gilkes | last post by:
I have a DataGrid which I am adding to the page dynamically at the Init stage of the page load. The DataGrid has AutoGenerateColumns turned off, has BoundColumns and is bound to a DataView for...
1
by: kevin | last post by:
Hi, I'm working with VS 2005 and Framework 2.0 I have a datagrid with a link and the selectedindexchanged will not fire. The page posts back but does nothing. Protected Sub...
0
by: Andy | last post by:
Probably this quesion was already raised, but I couldn't find any answer to it, even on Google. My question is: I have a plain datagrid on a page, and I'm adding a button column to it. When...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.