delete button

T

Trond

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
 
G

Guest

Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteCommand);

HTH

Elton Wang
(e-mail address removed)
 
T

Trond

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 said:
Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteCommand);

HTH

Elton Wang
(e-mail address removed)


Trond said:
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
 
T

Trond

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 said:
Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteCommand);

HTH

Elton Wang
(e-mail address removed)


Trond said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top