dynamic datagrid

G

Guest

I am using a dynamic datagrid and want to add the "delete" command,but no
matter what I try I cannot get it to work. This is what I have:

ButtonColumn del = new ButtonColumn();
del.Text = "deleteTest";
del.ButtonType = ButtonColumnType.LinkButton;
del.CommandName = "Delete";
DG.Columns.Add(del);


DG.ItemDataBound += new
System.Web.UI.WebControls.DataGridItemEventHandler(this.dgAssDealers_ItemDataBound);
DG.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgAssDealers_DeleteCommand);


The ItemDataBound works fine, but not the Delete. The button shows up in the
grid, but it's not "linked" , in other words, there's nothing to click. Has
anyone got any idea how to do this? I've been banging my head all weekend on
this and just cannot get it to work :(
 
D

Dave

I am using a dynamic datagrid and want to add the "delete" command,but no
matter what I try I cannot get it to work. This is what I have:

ButtonColumn del = new ButtonColumn();
del.Text = "deleteTest";
del.ButtonType = ButtonColumnType.LinkButton;
del.CommandName = "Delete";
DG.Columns.Add(del);

DG.ItemDataBound += new
System.Web.UI.WebControls.DataGridItemEventHandler(this.dgAssDealers_ItemDa­taBound);
DG.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgAssDealers_Del­eteCommand);

The ItemDataBound works fine, but not the Delete. The button shows up in the
grid, but it's not "linked" , in other words, there's nothing to click. Has
anyone got any idea how to do this? I've been banging my head all weekend on
this and just cannot get it to work :(

it looks like you are using the generic command event handler with the
key word delete. try using the event handler for delete or changing
your commandName to deleteme or something like that.
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top