473,320 Members | 1,857 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,320 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 1298
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.