By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

delete button

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.