WHERE IS *.ASPX.DESIGNER.VB FILES???????

  • Thread starter Thread starter pickedaname
  • Start date Start date
P

pickedaname

I am so frustrated, as is USUAL using Visual Studio.
NONE, NOOOOONE of my aspx files have associated designer.vb files available
(And yes, they all have the .vb code behind files).
All of my aspx files were created with the seperate code file option. I
never needed to access the designer files before, so I have no idea if they
were ever there. If they are not, how are events being wired up? They MUST be
present. Now that I DO need them, I cannot access them at all. I have tried
clicking the "show all files" in solution exporer, which is always dimmed out
but is clickable. And what makes it worse is I have just spent 2 hours
pulling my hair out on google with no results, as is usual when dealing with
Visual Studio issues. It's times like this that I SOOOOOOO REGRET not
learning UNIX/JAVA instead!!!!!!!!!
Please help me, if for anything, the $1,000's of dollars that I have spent
on MSDN subscriptions!
 
Hello pickedaname, if you create a new website (not a web application) then
there will not be any designer file and event wiring is through the aspx.
Can you post your page, if wiring is not event present in aspx?

Thanks,
Harshal
 
You've most likely made an ASP .NET Web "Site", rather than an ASP .NET "Web
Application Project" (only available in VS 2005 SP1 or VS 2008).

With web "sites", there is no .designer.vb file because the code is
dynamically compiled when it is called. You'll notice that in the Page
Directives (in the .aspx source code) that the AutoEventWireUp directive is
set to true, this means that as long as your event handler names are a
combination of the control name, an underscore and the event name, along
with appropriate parameters, the event will automatically "wire up" to the
event handler.

Any controls you put on your page are created "declaratively" and so, no
..NET code actually exists for them at design-time.

What is it that you need to do that you can't do with this model?

-Scott
 
Hi Scott,
I was trying to add a MultiMenu control to a test page (I want to test
before I move it to the production master page) within the same site. I
cannot handle events for this control. in the code behind, when I create a
sub for the multiMenu1_MenuItemClicked, the "Handles MultiMenu1.Clicked"
portion is underlined. "Handles clause requires a withevents variable defined
in the containing type or one of its base types." So what you are saying is
if I create a sub
MultiMenu1_MenuItemClicked Sub without the Handles clause and
autoeventwireup is true it will create this on the fly. The question is, am I
free to create this sub in the code behind file, where the others are, or
must I insert this into a script block in the .aspx file? Thanks.
 
You should not have to manually create any event handler sub under any
circumstance.

After adding the control to your page, just double-click it. This will take
you to code view and VS will create an event handler for you. If it is not
the correct event handler (VS uses the default event of any control, so it
doesn't always guess correctly), just pull down the event dropdown listbox
in the top, right of the code editor and select the correct event. As soon
as you do that, VS will create the correct event handler stub for you.

That's all you have to do. You really don't need to worry about
AutoEventWireUp or Handles - VS takes care of it for you.

-Scott
 
Hi pickedaname,

Which version of Visual Studio are you using?

I believe you probably are using the Web Application Project instead of
Website mode (which is introduced since Visual Studio 2005) since the
toolbar button "Show All Files" is not available in website mode.

For AutoEventWireup, it's recommended to set to "false" for performance
reason:


ASP.NET Server Control Event Model
(http://msdn2.microsoft.com/en-us/library/59t350k3(VS.71).aspx)
<blockquote>
If the AutoEventWireup attribute of the Page directive is set to true (or
if it is missing, since by default it is true), the page framework calls
page events automatically, specifically the Page_Init and Page_Load
methods. In that case, no explicit Handles clause or delegate is needed.

The disadvantage of the AutoEventWireup attribute is that it requires that
the page event handlers have specific, predictable names. This limits your
flexibility in how you name your event handlers. Therefore, in Visual
Studio, the AutoEventWireup attribute is set to false by default and the
designer generates explicit code to bind page events to methods.

If you do set AutoEventWireup to true, Visual Studio will generate code to
bind the events and the page framework will automatically call events based
on their names. This can result in the same event code being called twice
when the page runs. As a consequence, you should always leave
AutoEventWireup set to false when working in Visual Studio.
</blockquote>


Hocke - Thoughts, Tutorials, Tips and Tricks: AutoEventWireup=true
(http://hocke.blogspot.com/2007/07/autoeventwireuptrue.html)



Hope this helps.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Interesting articles Walter, it's a wonder then, that in a C# WAP,
AutoEventWireUp is automatically set to "true" on each page added to the
project, rather than "false".

Thanks,

Scott
 
Now, contrary to that last article, in:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/dv_aspnetcon/html/6304bff7-1b0e-4641-8acb-6d3b0badc4a3.htm
it says:

"If you prefer, you can create handlers explicitly. The automatic binding of
page events based on the method naming convention is controlled by a page
property named AutoEventWireup. By default, this property is set to true,
and ASP.NET performs the automatic lookup and binding described earlier.
Alternatively, you can set this property to false by adding the attribute
AutoEventWireup=false in the @ Page directive. You can then create methods
with any name and bind them to page events explicitly."

Which is the behavior I'm seeing.

-Scott

Scott M. said:
According to:
http://msdn2.microsoft.com/en-us/library/system.web.configuration.pagessection.autoeventwireup.aspx
it says "By default, when the ASP.NET Web application is created in Visual
Studio, the value of the AutoEventWireup attribute is set to false in the
.aspx page or .ascx control, and event handlers are not automatically
created."

However, in my C# WAP, AutoEventWireUp is automatically being written with
"true" as the value, not false.

-Scott

"Walter Wang [MSFT]" said:
Hi pickedaname,

Which version of Visual Studio are you using?

I believe you probably are using the Web Application Project instead of
Website mode (which is introduced since Visual Studio 2005) since the
toolbar button "Show All Files" is not available in website mode.

For AutoEventWireup, it's recommended to set to "false" for performance
reason:


ASP.NET Server Control Event Model
(http://msdn2.microsoft.com/en-us/library/59t350k3(VS.71).aspx)
<blockquote>
If the AutoEventWireup attribute of the Page directive is set to true (or
if it is missing, since by default it is true), the page framework calls
page events automatically, specifically the Page_Init and Page_Load
methods. In that case, no explicit Handles clause or delegate is needed.

The disadvantage of the AutoEventWireup attribute is that it requires
that
the page event handlers have specific, predictable names. This limits
your
flexibility in how you name your event handlers. Therefore, in Visual
Studio, the AutoEventWireup attribute is set to false by default and the
designer generates explicit code to bind page events to methods.

If you do set AutoEventWireup to true, Visual Studio will generate code
to
bind the events and the page framework will automatically call events
based
on their names. This can result in the same event code being called twice
when the page runs. As a consequence, you should always leave
AutoEventWireup set to false when working in Visual Studio.
</blockquote>


Hocke - Thoughts, Tutorials, Tips and Tricks: AutoEventWireup=true
(http://hocke.blogspot.com/2007/07/autoeventwireuptrue.html)



Hope this helps.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.
 
Hello Scott M.,
According to:
http://msdn2.microsoft.com/en-us/library/system.web.configuration.page
ssection.autoeventwireup.aspx it says "By default, when the ASP.NET
Web application is created in Visual Studio, the value of the
AutoEventWireup attribute is set to false in the .aspx page or .ascx
control, and event handlers are not automatically created."

However, in my C# WAP, AutoEventWireUp is automatically being written
with "true" as the value, not false.

I can't remember in detail and haven't looked since, but I remember something
about the default being changed between VS2005 and VS2008
 
Hi Scott,

Thanks for your information. I just checked the MSDN online documentation
and did some test, yes AutoEventWireup is being set to "true" by default in
VS2005 and VS2008; while it was set to "false" in VS2003. The documentation
is probably updated after VS2003 but is not consistent in all places.

I will forward this information to MSDN documentation team. Please also
feel free to use the "Community Content" feature of MSDN online to add your
comments. Thanks.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top