[Mono-list] DataGridCommandEventHandler not being invoked

simon godden sgodden at gmail.com
Mon Nov 21 16:35:07 EST 2005


I've created a data grid - no problem.

Now I want to be notified when the Edit button is pressed. But my handler is
never invoked.

My code looks like this:

public class EntityTable : DataGrid
{
private static ILog log = LogManager.GetLogger(typeof(EntityTable));

public EntityTable(string classname) : base()
{
AutoGenerateColumns = false;

EditCommand += new DataGridCommandEventHandler(this.EditCommandClicked);
EntityList list = GenericServiceFactory.Service.GetListForEntity(classname);
CreateColumns(list);
DataSource = CreateDataSource(list);
DataBind();


}

public void EditCommandClicked(object source, DataGridCommandEventArgs e)
{
Console.WriteLine("ASD"+e);
}

private void CreateColumns(EntityList list)
{
EditCommandColumn col1 = new EditCommandColumn();
col1.ButtonType = ButtonColumnType.PushButton;
col1.EditText = "Edit";
col1.UpdateText = "Update";
col1.CancelText = "Cancel";

Columns.Add(col1);

int nbrCols = list.Lines[0].Cells.Length;
for (int i=0; i<nbrCols; i++)
{
BoundColumn bc = new BoundColumn();
bc.DataField = "Column "+i;
Columns.Add(bc);
}

}

Can anyone see anything wrong?

--
Simon Godden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20051121/e9acc7b9/attachment-0001.html


More information about the Mono-list mailing list