Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Extension Methods.. For back ward compatibility..
posted

I am writing extension methods for a old code that I am trying to migrate without changing the actual code... 

Here is the scenario -

Here is what I have

UltraWebGridObject.DisplayLayout.AllowEdit = true;

And wanting it to perform this without changing the code.. 

WebHeirarchicalDataGridObject.Behaviors.EditingCore.Behaviors.CellEditing.Enabled = true;

Now I wrote a extension method for DisplayLayout like this (Not sure if this is even the way to attack this problem). (As DisplayLayout does not exist in the new WebDataGrid) 

public static EditingBehaviorCollection DisplayLayout(this WebHierarchicalDataGrid grid) {     return grid.Behaviors.EditingCore.Behaviors; }

How can I write a extension method for AllowDeleteDefault and set the true to it? Did I make any sense? The reason I am trying this there are several places in my code and code behind where this piece exists and i would not like to touch the code and mess it up. 

Thoughts or suggestions - Please..