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

delete button

I added a delete button to a datagrid. I also added an event:
private void dgMessages_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

I added this to event:

Label1.Text=dgMessages.DataKeys[e.Item.ItemIndex].ToString();

but the label is not set to the DataKey.

I set a breakpoint in it but nada. It appears to me that the datagrid is
not firing the event.

What is it that i am missing?

Best regards

Trond
Nov 19 '05 #1
3 1301
Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteComma nd);

HTH

Elton Wang
el********@hotmail.com
"Trond" wrote:
I added a delete button to a datagrid. I also added an event:
private void dgMessages_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

I added this to event:

Label1.Text=dgMessages.DataKeys[e.Item.ItemIndex].ToString();

but the label is not set to the DataKey.

I set a breakpoint in it but nada. It appears to me that the datagrid is
not firing the event.

What is it that i am missing?

Best regards

Trond

Nov 19 '05 #2
Ahh thank you, but there is one. I use VS 2003 and i generated one by double
clicking in the datagrids event list (properties)
I also added the event trigger manually just i case, but still nothing. So i
am a lil confused now. I added the Delete button using the datagrid Property
Builder.
Best regards
Trond

"Elton W" <El****@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteComma nd);

HTH

Elton Wang
el********@hotmail.com
"Trond" wrote:
I added a delete button to a datagrid. I also added an event:
private void dgMessages_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

I added this to event:

Label1.Text=dgMessages.DataKeys[e.Item.ItemIndex].ToString();

but the label is not set to the DataKey.

I set a breakpoint in it but nada. It appears to me that the datagrid
is
not firing the event.

What is it that i am missing?

Best regards

Trond

Nov 19 '05 #3
Ohhh.... I feel stupid now :-) I forgot to recompile. I just launched and
tested. Guess I need to sleep :-)

Thank you a lot for helping me out here.
Best regards
Trond
"Elton W" <El****@discussions.microsoft.com> wrote in message
news:94**********************************@microsof t.com...
Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteComma nd);

HTH

Elton Wang
el********@hotmail.com
"Trond" wrote:
I added a delete button to a datagrid. I also added an event:
private void dgMessages_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

I added this to event:

Label1.Text=dgMessages.DataKeys[e.Item.ItemIndex].ToString();

but the label is not set to the DataKey.

I set a breakpoint in it but nada. It appears to me that the datagrid
is
not firing the event.

What is it that i am missing?

Best regards

Trond

Nov 19 '05 #4

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

Similar topics

3
by: Uwe Range | last post by:
Hi to all, I am displaying a list of records in a subform which is embedded in a popup main form (in order to ensure that users close the form when leaving it). It seems to be impossible to...
9
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
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...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
3
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
4
by: wim taerwe | last post by:
Hello, I am looking for an easy way to have a delete button per subitem in 1 form. For example : a book can have many authors and when I edit the book details I want to have a list of the...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
3
by: bluez | last post by:
I want to design a webpage where user can search the data from the database and list out the related records. Each of the record got a delete button which allow user to delete the record. ...
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
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...
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
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.