Dynamic Data: Customizing the Confirmation Message


A while ago, I demonstrated how to Display Custom Format Names for you entity objects in ASP.NET Dynamic Data. Today, I show you how to change the confirmation message for the Delete LinkButton and include information regarding the row being deleted.

 If you simply try to use,


You might get:


And you don’t want that. The reason it happens is because of some of the magic the EntityDataSource does, it actually does not return the object from the EDM but instead returns a wrapped version of the object that contains some additional properties. When you override ToString they go through a path in the code that does not know about the wrapped object and thus the ToString() returns the wrapper object which is why you get the behaviour you see. If you are facing this issue, here is the best way to customize the confirmation message so you can solve this:

First step, change the List.aspx to the following markup:

protected string GetDisplayString()
    object displayObject = DataBinder.GetPropertyValue(GetDataItem(), table.DisplayColumn.Name);
    return displayObject == null ? string.Empty : displayObject.ToString();


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s