Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete message in mmDataGrid
Message
From
05/11/2004 20:33:39
 
 
To
04/11/2004 18:47:48
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
00958329
Message ID:
00958730
Views:
12
Figured it out myself...

In a derived (new) mmDataGrid you need to override the OnItemDataBound method as shown below. You will also need to find the Delete button (I'm not sure if I want a message on the Edit button yet or if I can make it work properly.)

On the definition of the class, you will need a private variable nDelete (nEdit for the Edit button).

Use your new derived control on the Web pages instead of the mmDataGrid.
// -1 is used instead of 0 because the columns begin at zero.
private int nDelete = -1;
//private int nEdit = -1;

protected override void OnItemDataBound(DataGridItemEventArgs e)
{
	base.OnItemDataBound (e);

	// the header ultimately figures out where (which column) the delete column is
	if (this.nDelete == -1) //|| this.nEdit == -1)
		this.FindButtons(e);

	if (this.nDelete > -1)
		e.Item.Cells[this.nDelete].Attributes.Add("onclick", "if(confirm('Are you sure to delete?')){}else{return false}");

	//if (this.nEdit > -1)
	//	e.Item.Cells[this.nEdit].Attributes.Add("onclick", "alert('Edit Hello');");
}
		
private void FindButtons(DataGridItemEventArgs e)
{
	int i = 0;
	foreach (TableCell cell in e.Item.Cells)
	{
		if (cell.Text == "Delete")
			this.nDelete = i;

		//if (cell.Text == "Edit")
		//	this.nEdit = i;

		i++;
	}
}
>How do I display a delete alert message from the delete button in a mmDataGrid?
>
>I have seen the code in the MM Help files for a simple Delete button on a form, but how to do the same thing in the mmDataGrid escapes me.
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform