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..

Parents
No Data
Reply
  • 49378
    posted

    Hello Kishore,

     

    Thank you for posting in the community.

    If you are planning to not change the code listed at the top, does this mean that you intend to extend the WebDataGrid control in order to expose a DisplayLayout with properties similar to the UltraWebGrid ones in this case ? I would suggest considering this carefully as this would require custom coding which may complicate the scenario further. Note that such customizations of the control or any issues following from that are not supported. As the UltraWebGrid and the AIKDO WebDataGrid have differing architectures I would suggest refactoring any UWG specific code to the WebDataGrid equivalent instead of attempting to expose an API for WebDataGrid, similar as the one in the ultra grid.

    Please do not hesitate to contact me with any questions.

Children