delete button

  • Thread starter Thread starter Trond
  • Start date Start date
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
 
Hi Trond,

You should have an event trigger in InitializeComponent:

dgMessages.DeleteCommand += new
DataGridCommandEventHandler(dgMessages_DeleteCommand);

HTH

Elton Wang
(e-mail address removed)
 
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
 
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
 
Back
Top