Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2006, 07:55 AM
Authorized User
 
Join Date: Nov 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid ItemCommand firing twice

Hi,

when tracing, my datagrid is firing ItemCommand twice when a select button is pressed. I am using DataGridCommandEventArgs to handle the events.

Could someone explain why this could be happening and how do i go about possibly rectifying it?

I thought it might of been once for the postback and once actually processing the button click, but when i wrap it in !IsPostBack no code executes. Hence, it must post back twice..But why?

Any help appreciated.
 
Old May 16th, 2007, 11:06 AM
Registered User
 
Join Date: May 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 The reason is in ASP.NET 1.1 onitem datacommand is like this



Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.ItemCommand





but in asp.net 2.0 you don't need Handles DataGrid1.ItemCommand



it should be like this

Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ).












Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid editcommand firing but not editTemplate janetb ASP.NET 2.0 Basics 0 March 27th, 2008 01:14 PM
DataGrid ItemCommand not fired jigsawcube1 General .NET 0 September 13th, 2007 06:33 AM
datalist itemcommand kethireddy435 ASP.NET 1.x and 2.0 Application Design 1 September 12th, 2007 06:58 AM
Firing Blanks... ozPATT Access VBA 11 January 20th, 2006 11:26 AM
DataList ItemCommand event problem in ASP.NET page naidukap ASP.NET 1.0 and 1.1 Professional 0 December 26th, 2005 03:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.