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

Data Grid Event Fires Twice..

Why does the method for on_ItemCommand fire twice when I press a button
contained within my grid?

My dgTask_ItemCommand which is the procedure name assigned to the
"on_ItemCommand" fires twice each and every time I press the button or link.
Why?

I have a datagrid in which I have and column defined as follows:
<asp:ButtonColumn Text="Edit" HeaderText="Edit"
CommandName="EditTask"></asp:ButtonColumn>

In the definition of the grid I have the following event defined...
OnItemCommand="dgTask_ItemCommand"

My method for dgTask_ItemCommand looks like the following:

public void dgTask_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if (e.CommandName == "EditTask")
{
int itemOffSet = 0;
if (dgTask.CurrentPageIndex > 0)
{ itemOffSet = dgTask.CurrentPageIndex * dgTask.PageSize; }
_EditRowID = (e.Item.ItemIndex + itemOffSet);
if (ViewState["EditRowID"] == null)
{ ViewState.Add("EditRowID", _EditRowID); }
else
{ ViewState["EditRowID"] = _EditRowID; }
dgTask_Edit_Command(_DvTask[_EditRowID].Row);
}
}

Nov 19 '05 #1
0 936

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

Similar topics

6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
0
by: Jim Heavey | last post by:
I am trying to understand the difference between specifying the "attribute" of "onEdit" when you are creating the HTML and going into VS in the Properties window and clicking on the events button...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
0
by: db007 | last post by:
I have a problem at the moment with a web project. I have two Panels within an UpdatePanel on an aspx page (using Masterpages). I'm using ASP.Net 2.0 with an AJAX enabled website. The two...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.