When extracting a part of an ASPX page as user control no codebehind file is created and no code of the related event handlers is extracted.
The litte (help-)hint that is shown when selecting the refactoring says: "Creates a user control from the selected block including content and dependant code"
Tested only with a VisualBasic based solution!
Tested it with a web application project (no website)
Steps to Reproduce:
Mark some ASPX code in the editor and select the refactoring "ExtractUserControl"
Actual Results:
Refactor creates an ASCX file that contains the selected block from the original ASPX page. No code behind file is created. Nothing of the underlying code (event handlers) is extracted.
Expected Results:
A code behind file with the eventhandlers used in the original selected block should be created.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
I have just tried the latest daily build and it shows the same behaviour: No code behind file is generated.
Is this fix not included in the daily builds?
Hi Ralf,
Unfortunately, these changes aren't included in the latest v3.2.3 build. They will be included in v9.1 that should be released within a few weeks. Please wait a bit.
Thanks,
Vito
Re-tested it with Refactor! Pro v2009 vol 1.2:
The code behind file is now created but the dependend code ist nmot moved to the new user control.
I had an event handler, attached to a button inside the ASPX code that modified a label inside the same ASPX code. I have extracted the complete ASPX code to an user control but the event handler of the button stays in the page and does not get extracted to the user control.
Hi Ralf,
I'm sorry to hear that the problem still exists on your side. However, I'm unable to reproduce it locally.
Can you please provide us with a small sample, where the issue is reproduced on your machine, as well as with step-by-step instructions on how to reproduce it using this sample?
Also, please let us know which other VS add-ins are installed on your machine: please click the "Copy Info" button in the "About Microsoft Visual Studio" dialog, and post the resulting information here.
Thanks,
Vito
I think i foud the problem:
Normally an eventhandler is attached to a control using the "handles" directive in VB:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button_1.Click
End Sub
That does not work. The event handler does not get extracted on my system.
If i hook this event handler in the ASPX code (OnClick="Button_1.Click") and choose "Extract usercontrol" then i find my event handler in the extracted usercontrol.
However the "handles" directive ist the standard way of hooking event handlers in VB (when you do a double click on a control to create a handler).
Does Refactor extract the code on your system when "handles" is used?
Ciao,
Ralf
P.S.: i have attached the info from the about box as textfile (it was too long fo this description field)
Additional info:
On my System no designer file is created. I get the "*.ascx" file but not the "*.ascx.designer.vb" (the designer managed part of the user control)
Hi Ralf,
Thank you for the explanation.
I see the problem now, and it definitely looks like a bug in the current product version. We'll do our best to fix it as soon as we can.
Thanks,
Vito
Any news on this issue?
Timeframe?
Hi Ralf,
Unfortunately, we haven't yet fixed this problem, and I'm afraid we can't provide you with a time frame in which it will be fixed, as this depends on a number of factors. I do understand that this problem is vital to you, and I'll ask our developers to fix this problem as soon as possible, if this is feasible. Please bear with us.
Thanks,
Vito
Tested it with the latest download - Works as expected!