473,396 Members | 2,034 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,396 software developers and data experts.

Difference

I have a DataGrid named "dgUsers". The OnDeleteCommand event of the
DataGrid invokes a handler named "DeleteUser". The OnUpdateCommand
event of the DataGrid invokes a handler named "UpdateUser". This is the
code:

Sub DeleteUser(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
Response.Write("Index1: " & ea.Item.ItemIndex & "<br>")
Response.Write("Index2: " & dgUsers.EditItemIndex & "<br>")
dgUsers.EditItemIndex = -1
dgUsers.DataBind()
End Sub

Sub UpdateUser(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
Response.Write("Index1: " & ea.Item.ItemIndex & "<br>")
Response.Write("Index2: " & dgUsers.EditItemIndex & "<br>")
dgUsers.EditItemIndex = -1
dgUsers.DataBind()
End Sub

<asp:DataGrid ID="dgUsers" OnDeleteCommand="DeleteUser"
OnUpdateCommand="UpdateUser" runat="server">
<Columns>
'a few BoundColumns come here
<asp:ButtonColumn ButtonType="LinkButton" CommandName="Delete"
HeaderText="DELETE" Text="DELETE"/>
<asp:EditCommandColumn........./>
</Columns
</asp:DataGrid>

For the Update link, I am using the EditCommandColumn of the DataGrid.

Suppose the user first clicks the Update link of the 3rd row in the
DataGrid (i.e. index=2). Both Index1 & Index2 in the "UpdateUser" sub
are 2. After this, the user clicks the "Delete" link (which is a
ButtonColumn in the DataGrid). Now when the page posts, Index1 & Index2
in the "DeleteUser" sub are 2 & -1 respectively.

Now what's the difference between ea.Item.ItemIndex &
dgUsers.EditItemIndex in the "DeleteUser" sub?

Nov 30 '06 #1
2 987
Not sure if I understand the question. EditItemIndex is only used for
editing.

<rn**@rediffmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
>I have a DataGrid named "dgUsers". The OnDeleteCommand event of the
DataGrid invokes a handler named "DeleteUser". The OnUpdateCommand
event of the DataGrid invokes a handler named "UpdateUser". This is the
code:

Sub DeleteUser(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
Response.Write("Index1: " & ea.Item.ItemIndex & "<br>")
Response.Write("Index2: " & dgUsers.EditItemIndex & "<br>")
dgUsers.EditItemIndex = -1
dgUsers.DataBind()
End Sub

Sub UpdateUser(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
Response.Write("Index1: " & ea.Item.ItemIndex & "<br>")
Response.Write("Index2: " & dgUsers.EditItemIndex & "<br>")
dgUsers.EditItemIndex = -1
dgUsers.DataBind()
End Sub

<asp:DataGrid ID="dgUsers" OnDeleteCommand="DeleteUser"
OnUpdateCommand="UpdateUser" runat="server">
<Columns>
'a few BoundColumns come here
<asp:ButtonColumn ButtonType="LinkButton" CommandName="Delete"
HeaderText="DELETE" Text="DELETE"/>
<asp:EditCommandColumn........./>
</Columns
</asp:DataGrid>

For the Update link, I am using the EditCommandColumn of the DataGrid.

Suppose the user first clicks the Update link of the 3rd row in the
DataGrid (i.e. index=2). Both Index1 & Index2 in the "UpdateUser" sub
are 2. After this, the user clicks the "Delete" link (which is a
ButtonColumn in the DataGrid). Now when the page posts, Index1 & Index2
in the "DeleteUser" sub are 2 & -1 respectively.

Now what's the difference between ea.Item.ItemIndex &
dgUsers.EditItemIndex in the "DeleteUser" sub?

Nov 30 '06 #2
Thanks Kevin...I got the answer I was looking out for.
Kevin Frey wrote:
Not sure if I understand the question. EditItemIndex is only used for
editing.

<rn**@rediffmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
I have a DataGrid named "dgUsers". The OnDeleteCommand event of the
DataGrid invokes a handler named "DeleteUser". The OnUpdateCommand
event of the DataGrid invokes a handler named "UpdateUser". This is the
code:

Sub DeleteUser(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
Response.Write("Index1: " & ea.Item.ItemIndex & "<br>")
Response.Write("Index2: " & dgUsers.EditItemIndex & "<br>")
dgUsers.EditItemIndex = -1
dgUsers.DataBind()
End Sub

Sub UpdateUser(ByVal obj As Object, ByVal ea As
DataGridCommandEventArgs)
Response.Write("Index1: " & ea.Item.ItemIndex & "<br>")
Response.Write("Index2: " & dgUsers.EditItemIndex & "<br>")
dgUsers.EditItemIndex = -1
dgUsers.DataBind()
End Sub

<asp:DataGrid ID="dgUsers" OnDeleteCommand="DeleteUser"
OnUpdateCommand="UpdateUser" runat="server">
<Columns>
'a few BoundColumns come here
<asp:ButtonColumn ButtonType="LinkButton" CommandName="Delete"
HeaderText="DELETE" Text="DELETE"/>
<asp:EditCommandColumn........./>
</Columns
</asp:DataGrid>

For the Update link, I am using the EditCommandColumn of the DataGrid.

Suppose the user first clicks the Update link of the 3rd row in the
DataGrid (i.e. index=2). Both Index1 & Index2 in the "UpdateUser" sub
are 2. After this, the user clicks the "Delete" link (which is a
ButtonColumn in the DataGrid). Now when the page posts, Index1 & Index2
in the "DeleteUser" sub are 2 & -1 respectively.

Now what's the difference between ea.Item.ItemIndex &
dgUsers.EditItemIndex in the "DeleteUser" sub?
Nov 30 '06 #3

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

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
21
by: b83503104 | last post by:
Hi, Can someone tell me the difference between single quote and double quote? Thanks
26
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: ...
21
by: Rich | last post by:
I was considering C# for developing a scientific application, but I have noticed a ~30% difference between VC++ .NET and C# on the same machine, under identical conditions: double a = 0,b = 0, c...
4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
3
by: bbawa1 | last post by:
Hi, I have a table which has a field ItemsReceived of type datetime. I have a grid view which has two columns. In first column i have to show the data from field ItemsReceived and in second...
12
by: Petronius | last post by:
Hallo, does anyone have an idea how to implement difference lists in Javascript? Thanks allot in advance
5
by: Julius | last post by:
Hej dudes, I need to calc the difference between two timestamps / dates ... For example what i need to calculate: Date 1: 2007.11.06 - 20:13:04 Date 2: 2007.11.07 - 21:13:04 Difference:...
9
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
11
by: cmb3587 | last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays Ex: arrayA: 3 5 8 9 arrayB: 3 4 6 9 difference of A-B: 5 8 however, my...
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...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.