473,387 Members | 1,574 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,387 software developers and data experts.

ItemCommand firing instead of SortCommand

Hi there,

I am having a weird problem. I have a datagrid with both an ItemCommand and
a SortCommand. It was working fine until a day ago. Now, whenever I click
a column to fire the SortCommand, the ItemCommand gets fired instead. In
the debugger, e.CommandName is equal to "Sort", even though it is being
handled by the ItemCommand event. If I remove the ItemCommand event
handler, it works fine, but as soon as I put it back in the same problem
occurs.

Any ideas would be greatly appreciated.

Thanks,

Steven
Nov 17 '05 #1
4 1982
the problem will lie in your initialize component section. It is daizy
chained to the wrong event. you can either re-chain it in code to the right
handler or use the property grid object event section to re-map the handler.
hth

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Steven" <ms******@berkovitz.org> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi there,

I am having a weird problem. I have a datagrid with both an ItemCommand and a SortCommand. It was working fine until a day ago. Now, whenever I click a column to fire the SortCommand, the ItemCommand gets fired instead. In
the debugger, e.CommandName is equal to "Sort", even though it is being
handled by the ItemCommand event. If I remove the ItemCommand event
handler, it works fine, but as soon as I put it back in the same problem
occurs.

Any ideas would be greatly appreciated.

Thanks,

Steven

Nov 17 '05 #2
Looks fine to me...

private void InitializeComponent()

{
this.productsGrid.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHand ler(this.productsGrid_ItemCommand);
this.productsGrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEvent Handler(this.productsGrid_PageIndexChanged);
this.productsGrid.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEvent Handler(this.productsGrid_SortCommand);
this.Load += new System.EventHandler(this.Page_Load);

}

"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in message news:%2******************@tk2msftngp13.phx.gbl...
the problem will lie in your initialize component section. It is daizy
chained to the wrong event. you can either re-chain it in code to the right
handler or use the property grid object event section to re-map the handler.
hth

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Steven" <ms******@berkovitz.org> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi there,

I am having a weird problem. I have a datagrid with both an ItemCommand

and
a SortCommand. It was working fine until a day ago. Now, whenever I

click
a column to fire the SortCommand, the ItemCommand gets fired instead. In
the debugger, e.CommandName is equal to "Sort", even though it is being
handled by the ItemCommand event. If I remove the ItemCommand event
handler, it works fine, but as soon as I put it back in the same problem
occurs.

Any ideas would be greatly appreciated.

Thanks,

Steven


Nov 17 '05 #3
Oh sorry, itemcommand fires first and then sortcommand fires after. If you
put a break point in your sort command, it will/should eventually fire. I'd
be happy to take a closer look if this doesn't work for you.

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Steven" <ms******@berkovitz.org> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
Looks fine to me...

private void InitializeComponent()

{
this.productsGrid.ItemCommand += new
System.Web.UI.WebControls.DataGridCommandEventHand ler(this.productsGrid_Item
Command);
this.productsGrid.PageIndexChanged += new
System.Web.UI.WebControls.DataGridPageChangedEvent Handler(this.productsGrid_
PageIndexChanged);
this.productsGrid.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEvent Handler(this.productsGrid_
SortCommand);
this.Load += new System.EventHandler(this.Page_Load);

}

"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:%2******************@tk2msftngp13.phx.gbl...
the problem will lie in your initialize component section. It is daizy
chained to the wrong event. you can either re-chain it in code to the right handler or use the property grid object event section to re-map the handler. hth

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Steven" <ms******@berkovitz.org> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi there,

I am having a weird problem. I have a datagrid with both an ItemCommand

and
a SortCommand. It was working fine until a day ago. Now, whenever I

click
a column to fire the SortCommand, the ItemCommand gets fired instead. In the debugger, e.CommandName is equal to "Sort", even though it is being
handled by the ItemCommand event. If I remove the ItemCommand event
handler, it works fine, but as soon as I put it back in the same problem
occurs.

Any ideas would be greatly appreciated.

Thanks,

Steven


Nov 17 '05 #4
Ahh. That solves the problem. Thanks!

"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:ux****************@TK2MSFTNGP10.phx.gbl...
Oh sorry, itemcommand fires first and then sortcommand fires after. If you
put a break point in your sort command, it will/should eventually fire. I'd be happy to take a closer look if this doesn't work for you.

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Steven" <ms******@berkovitz.org> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
Looks fine to me...

private void InitializeComponent()

{
this.productsGrid.ItemCommand += new
System.Web.UI.WebControls.DataGridCommandEventHand ler(this.productsGrid_Item Command);
this.productsGrid.PageIndexChanged += new
System.Web.UI.WebControls.DataGridPageChangedEvent Handler(this.productsGrid_ PageIndexChanged);
this.productsGrid.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEvent Handler(this.productsGrid_ SortCommand);
this.Load += new System.EventHandler(this.Page_Load);

}

"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:%2******************@tk2msftngp13.phx.gbl...
the problem will lie in your initialize component section. It is daizy
chained to the wrong event. you can either re-chain it in code to the

right
handler or use the property grid object event section to re-map the

handler.
hth

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Steven" <ms******@berkovitz.org> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi there,

I am having a weird problem. I have a datagrid with both an ItemCommand
and
a SortCommand. It was working fine until a day ago. Now, whenever I

click
a column to fire the SortCommand, the ItemCommand gets fired instead. In the debugger, e.CommandName is equal to "Sort", even though it is

being handled by the ItemCommand event. If I remove the ItemCommand event
handler, it works fine, but as soon as I put it back in the same problem occurs.

Any ideas would be greatly appreciated.

Thanks,

Steven



Nov 17 '05 #5

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

Similar topics

2
by: Ken Tucker | last post by:
I've read about this issue in many articles across the net... But haven't found a solution. I see all kinds of custom code to perform sorting with datagrids, but my example is so simple, I must...
2
by: ChrisB | last post by:
I'm attempting to open a new window from a LinkButton in a DataGrid. I can set a session variable in the ItemCommand event for the LinkButton like so: // this is used to handle the ItemCommand...
2
by: Deepesh | last post by:
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...
2
by: Curt_C [MVP] | last post by:
I've got a Repeater and within it a LinkButton. The LinkButton has an CommandName="Test" In the Repeater's ItemCommand event I want to check for this command name but the problem I'm having is...
4
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
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...
1
by: Joe | last post by:
Hello All: I have the understanding that the datagrid requires that ViewState be turned on in order to use the ItemCommand, EditCommand,SortCommand, etc event handlers. Does anyone know if this...
1
by: shantanu_kush | last post by:
Hi there, I am using a DataList in a composite control. The DataList has an Custom ItemTemplate(ITemplate) which adds a Button to the DataList Item as shown in the code below : public class...
1
by: rajkumarbathula | last post by:
Hi I am struckup with a big issue. ie., On my Page i am rendering 2 dynamic datalists each has dynamic link buttons. my problem is: i am not able to handle ItemCommandEvent of both the...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.